Modify the BootStrap Datepicker plug-in to the default Chinese implementation method, bootstrapdatepicker
Bootstrap-datepicker is a very good time selection plug-in. By default, it displays dates in English. You can use the following several small changes to support default Chinese characters:
1. First save the bootstrap-datepicker.js as UTF-8 format
2. added the cn language option.
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"}, cn: {days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Saturday ", "Sunday"], daysShort: ["day", "one", "two", "three", "four", "five", "Six ", "7"], daysMin: ["day", "1", "2", "3", "4", "5", "6 ", "7"], months: ["August ", "August", "August", "August"], monthsShort: ["August ", "August", "August"], today: "today", clear: "clear "}};
The red part is the added language option.
3. Modify the default parameters. The default language is cn.
var defaults = $.fn.datepicker.defaults = { autoclose: false, beforeShowDay: $.noop, calendarWeeks: false, clearBtn: false, daysOfWeekDisabled: [], endDate: Infinity, forceParse: true, format: 'mm/dd/yyyy', keyboardNavigation: true, language: 'cn', minViewMode: 0, orientation: "auto", rtl: false, startDate: -Infinity, startView: 0, todayBtn: false, todayHighlight: false, weekStart: 0 };
The red part indicates the modified default language.
Now, the default Chinese version is modified. The effect is as follows:
The above section describes how to modify the BootStrap Datepicker plug-in to the default Chinese language. I hope it will be helpful to you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!