Resolves jquery's datepicker localization and today's issues _jquery

Source: Internet
Author: User
1, localization
You can load the file directly, or you can add the following statement directly behind the script
Copy Code code as follows:

JQuery (function ($) {
$.datepicker.regional[' ZH-CN '] = {
Closetext: ' Close ',
Prevtext: ' < last month ',
Nexttext: ' Next month > ',
Currenttext: ' Today ',
MonthNames: [' January ', ' February ', ' March ', ' April ', ' May ', ' June ',
' July ', ' August ', ' September ', ' October ', ' November ', ' December ',
Monthnamesshort: [' One ', ' two ', ' three ', ' four ', ' five ', ' six ',
' Seven ', ' eight ', ' nine ', ' ten ', ' 11 ', ' 12 '],
DayNames: [' Sunday ', ' Monday ', ' Tuesday ', ' Wednesday ', ' Thursday ', ' Friday ', ' Saturday '],
Daynamesshort: [' Sunday ', ' Monday ', ' Tuesday ', ' Wednesday ', ' Thursday ', ' Friday ', ' Saturday '],
Daynamesmin: [' Day ', ' one ', ' two ', ' three ', ' four ', ' five ', ' six '],
Weekheader: ' Zhou ',
DateFormat: ' Yy-mm-dd ',
Firstday:1,
Isrtl:false,
Showmonthafteryear:true,
Yearsuffix: ' Year '
};
$.datepicker.setdefaults ($.datepicker.regional[' ZH-CN '));
});

2. Click today to display the date directly in input, instead of jumping to today's location and requiring users to click the date again to modify the method is very simple, add this code in the script
Copy Code code as follows:

$.datepicker._gototoday = function (ID) {
var target = $ (ID);
var inst = this._getinst (target[0]);
if (This._get (inst, ' gotocurrent ') && 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._notifychange (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.