我在bootstrap https://bootstrap-datepicker.readthedocs.org/en/latest/
中使用此DatePicker但我希望我的月份/日期在瑞典,所以我进入了Javascript,我确实更改了以下行:language: 'en',
language: 'sv',
但是我的DatePicker看起来像这样:
DatePicker设置:
var defaults = $.fn.datepicker.defaults = {
autoclose: true,
beforeShowDay: $.noop,
beforeShowMonth: $.noop,
calendarWeeks: false,
clearBtn: false,
toggleActive: false,
daysOfWeekDisabled: [],
datesDisabled: [],
endDate: Infinity,
forceParse: true,
format: 'yyyy-mm-dd',
keyboardNavigation: true,
language: 'sv',
minViewMode: 0,
multidate: false,
multidateSeparator: ',',
orientation: "auto",
rtl: false,
startDate: -Infinity,
startView: 0,
todayBtn: false,
todayHighlight: false,
weekStart: 1,
disableTouchKeyboard: false,
enableOnReadonly: true,
container: 'body'
};
我的视图中的我的DatePicker:
$(function () {
$(function () {
$('#fromDate').datepicker({
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: "yy-mm-dd",
firstDay: 1,
onSelect: function (dateText) {
$('#EndDate').datepicker('option', 'minDate', new Date(dateText));
}
});
$('#toDate').datepicker({
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: "yy-mm-dd",
firstDay: 1,
onSelect: function (dateText) {
$('#EndDate').datepicker('option', 'minDate', new Date(dateText));
}
});
});
});
答案 0 :(得分:3)
您已将language
从en
更改为sv
,但您还需要包含外部js
以支持瑞典语,您可以得到它
<强> Swedish JS 强>
现在,您只需在script src
添加js
之后添加bootstrap-datepicker.js
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/locales/bootstrap-datepicker.sv.min.js"></script>
<强> Working DEMO 强>