The bootstrap datepicker plug-in is changed to Chinese by default in English and bootstrapdatepicker
The default datepicker plug-in is in English and is in the format of mm/dd/yyyy.
Modify target:
1. Chinese characters are displayed by default.
2. Format: yyyy-mm-dd
You need to modify the following two items:
1. Change the datas object and add the en-cn language option. For details, see the 1419 line of source code.
Var dates = $. fn. datepicker. dates = {en: {days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday ", "Sunday"], daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat ", "Sun"], daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa ", "Su"], months: ["January", "February", "March", "l", "May", "June", "July", "August ", "September", "October", "November", "December"], monthsShort: ["Jan", "Feb", "Mar", "Apr", "May ", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], today: "Today", clear: "Clear"}, "zh-cn": {days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday ", "Saturday", "Sunday"], daysShort: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday ", "Sunday"], daysMin: ["day", "one", "two", "three", "four", "five", "Six ", "Day"], months: ["August ", "August", "August"], monthsShort: ["August ", "August ", "December"], today: "today", clear: "empty "}};
The red part is the new part.
2. Modify the default parameter, that is, the ults object.
Var defaults = $. fn. datepicker. defaults = {autoclose: false, beforeShowDay: $. noop, calendarWeeks: false, clearBtn: false, daysOfWeekDisabled: [], endDate: Infinity, forceParse: true, format: 'yyyy mm dd Day', keyboardNavigation: true, language: 'zh-cn', minViewMode: 0, multidate: false, multidateSeparator: ',', orientation: "auto", rtl: false, startDate:-Infinity, startView: 0, todayBtn: false, todayHighlight: false, weekStart: 0 };
3. The effect is as follows:
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.