答案 0 :(得分:1)
要显示周数,您应使用calendarWeeks
选项并将其设置为true
,因为默认情况下为false
。要设置一周的开始日期,请参阅选项weekStart
:
$(document).ready(function () {
$('#date').datepicker({
calendarWeeks: true; // Whether or not to show week numbers
weekStart: 0; // Day of the week start. 0 for Sunday; 1 for Monday
});
});
详细了解Bootstrap-Datepicker Documentation
中的选项和设置该插件支持月份和工作日名称的 i18n 和weekStart
选项。默认值为英语(“en”); js/locales/
目录中提供了其他可用的翻译,只需在插件后包含所需的语言环境即可。要添加更多语言,只需在调用$.fn.datepicker.dates
之前向.datepicker()
添加密钥即可。
示例:
$.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", "April", "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"
};
从右到左的语言也可能包含rtl: true
,以便正确显示日历。