我想自定义我的日历,
这是当前代码。
我如何更改它以符合新要求。
:javascript
$(document).ready(function() {
$('#date-range-picker').daterangepicker(
{
format: 'YYYY/MM/DD',
dateLimit: { days: 30 }
},
function(start, end, label) {
console.log(start.toISOString(), end.toISOString(), label);
}
);
});
最佳答案
你有很好的文档和Configuration Generator在 daterangepicker地点。您应该使用 locale
对象,如下所示:
$(document).ready(function() {
$('#date-range-picker').daterangepicker({
format: 'YYYY/MM/DD',
dateLimit: { days: 30 },
locale: {
"format": "MM/DD/YYYY",
"separator": " - ",
"applyLabel": "Apply",
"cancelLabel": "Cancel",
"fromLabel": "From",
"toLabel": "To",
"customRangeLabel": "Custom",
"daysOfWeek": [
"Su",
"Mo",
"Tu",
"We",
"Th",
"Fr",
"Sa"
],
"monthNames": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"firstDay": 1
},
},
function(start, end, label) {
console.log(start.toISOString(), end.toISOString(), label);
});
});
关于javascript - 我如何使用日期格式自定义日期范围选择器并使用 i18n 提示文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31954205/