目前我正在使用jQuery datetimepicker,我需要禁用日期。
使用“M-d-Y”格式无效。相反,它使用“d.m.y”格式
这是我的代码
$('.datetimepicker').datetimepicker({
i18n: {
en: {
months: [
'January', 'February', 'March', 'April',
'may', 'June', 'July', 'August',
'September', 'october', 'November', 'December',
],
dayOfWeek: [
"So.", "Mo", "Di", "Mi",
"Do", "Fr", "Sa.",
]
}
},
timepicker: true,
format: 'M-d-Y G:i',
disabledWeekDays: [0, 6],
disabledDates: ['Aug-15-2018'], formatDate: 'M.d.Y'
});
答案 0 :(得分:1)
如果您使用此datetimepicker插件,则此行中有拼写错误:
formatDate: 'M.d.Y'
将该行更改为:
formatDate: 'M.d.Y'
$('.datetimepicker').datetimepicker({
i18n: {
en: {
months: [
'January', 'February', 'March', 'April',
'may', 'June', 'July', 'August',
'September', 'october', 'November', 'December',
],
dayOfWeek: [
"So.", "Mo", "Di", "Mi",
"Do", "Fr", "Sa.",
]
}
},
timepicker: true,
format: 'M-d-Y',
disabledWeekDays: [0, 6],
disabledDates: ['Aug.15.2018'],
formatDate: 'M.d.Y'
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://rawgit.com/xdan/datetimepicker/master/build/jquery.datetimepicker.min.css">
<script src="https://rawgit.com/xdan/datetimepicker/master/build/jquery.datetimepicker.full.min.js"></script>
<input class="datetimepicker" type="text" >