Solve jquery's datepicker localization and Today Problems

Source: Internet
Author: User

1. Localization
You can directly load the file or add the following statement after the script. Copy codeThe Code is as follows: jQuery (function ($ ){
$. Datepicker. regional ['zh-cn'] = {
CloseText: 'close ',
PrevText: '<last month ',
NextText: 'Next month> ',
CurrentText: 'Today ',
MonthNames: ['August 11', 'August 11', 'August 11', 'August 11', 'August 11 ',
'October ', 'October'],
MonthNamesShort: ['1', '2', '3', '4', '5', '6 ',
'7', '8', '9', '10', '11', '12'],
DayNames: ['sunday', 'monday', 'tuesday', 'weday', 'thursday', 'Friday'],
DayNamesShort: ['sunday', 'monday', 'tues', 'wedneth', 'thurs', 'Friday', 'satur'],
DayNamesMin: ['day', 'yi', '2', '3', '4', '5', '6'],
WeekHeader: 'Week ',
DateFormat: 'yy-mm-dd ',
FirstDay: 1,
IsRTL: false,
ShowMonthAfterYear: true,
YearSuffix: 'Year'
};
$. Datepicker. setDefaults ($. datepicker. regional ['zh-cn']);
});

2. Click Today (Today) to display the date directly in the input, instead of redirecting to the current place. It is easy to click the date modification method again. Add this code in the script.Copy codeThe Code is as follows: $. datepicker. _ gotoday = function (id ){
Var target = $ (id );
Var inst = this. _ getInst (target [0]);
If (this. _ get (inst, 'gostream') & inst. currentDay ){
Inst. selectedDay = inst. currentDay;
Inst. drawMonth = inst. selectedMonth = inst. currentMonth;
Inst. drawYear = inst. selectedYear = inst. currentYear;
}
Else {
Var date = new Date ();
Inst. selectedDay = date. getDate ();
Inst. drawMonth = inst. selectedMonth = date. getMonth ();
Inst. drawYear = inst. selectedYear = date. getFullYear ();
This. _ setDateDatepicker (target, date );
This. _ selectDate (id, this. _ getDateDatepicker (target ));
}
This. _ policychange (inst );
This. _ adjustDate (target );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.