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);
}