momentJs 年停在了 2006 年
momentJs year stopped at 2006
在 daterangepicker 中年份停止在 2006 年我不知道为什么?
我的代码是:
<script type="text/javascript">
moment.locale('fr');
$(document).ready(function () {
$('#sdate').daterangepicker({
singleDatePicker: true,
timePicker: true,
timePicker24Hour: true,
locale: {
format: "LLLL",
applyLabel: 'Appliquer',
cancelLabel: 'Annuler'
},
firstDay: 1
});
});
</script>
我电脑上的时间是正确的
我们必须规范我们的源代码,以便能够 运行 在所有浏览器中。
1 - 使用 format+string
2 - 不要在日期中使用点“.”或“-”我们必须只使用“[=23” =]/"
3 - 你可以看到 this document
所以 "format" 部分的代码将是这样的:
<script type="text/javascript">
moment.locale('fr');
$(document).ready(function () {
$('#sdate').daterangepicker({
singleDatePicker: true,
timePicker: true,
timePicker24Hour: true,
locale: {
format: ("Jeudi 14/Janvier/2016 10:30", "dddd DD/MMMM/YYYY HH:mm"),
applyLabel: 'Appliquer',
cancelLabel: 'Annuler'
},
firstDay: 1
});
});
</script>
在 daterangepicker 中年份停止在 2006 年我不知道为什么?
我的代码是:
<script type="text/javascript">
moment.locale('fr');
$(document).ready(function () {
$('#sdate').daterangepicker({
singleDatePicker: true,
timePicker: true,
timePicker24Hour: true,
locale: {
format: "LLLL",
applyLabel: 'Appliquer',
cancelLabel: 'Annuler'
},
firstDay: 1
});
});
</script>
我电脑上的时间是正确的
我们必须规范我们的源代码,以便能够 运行 在所有浏览器中。
1 - 使用 format+string
2 - 不要在日期中使用点“.”或“-”我们必须只使用“[=23” =]/"
3 - 你可以看到 this document
所以 "format" 部分的代码将是这样的:
<script type="text/javascript">
moment.locale('fr');
$(document).ready(function () {
$('#sdate').daterangepicker({
singleDatePicker: true,
timePicker: true,
timePicker24Hour: true,
locale: {
format: ("Jeudi 14/Janvier/2016 10:30", "dddd DD/MMMM/YYYY HH:mm"),
applyLabel: 'Appliquer',
cancelLabel: 'Annuler'
},
firstDay: 1
});
});
</script>