gpt4 book ai didi

javascript - Bootstrap 3 日期选择器 minDate 错误

转载 作者:行者123 更新时间:2023-11-30 21:17:21 25 4
gpt4 key购买 nike

我正在使用 Bootstrap3 : DateTimePicker

问题是我当前的代码将月份与日期互换。

示例:使用“07/08/2017 20:38”作为输入,日历将 minDate 设置为“08/07/2017 23:38”

  <script>
$(function () {
$('#datetimepicker1').datetimepicker({
format: "DD/MM/YYYY HH:mm",
minDate: moment.unix(@Model.foo).format("DD/MM/YYYY HH:mm")
});
});
</script>

最佳答案

(Bootstrap 3 DatePicker)文档::MinMaxDate

minDate(minDate)

Takes a minDate string, Date, moment, boolean:false parameter and disallows the user to select a moment that is before that moment. If a boolean:false value is passed the options.minDate parameter is cleared and there is no restriction to the miminum moment the user can select.

我也会使用 MomentJS图书馆。

使用以下代码片段获取正确的 Date 没有问题:

Date.parse(moment("23/12/1990 23:45", "DD-MM-YYYY HH:mm"));

关于javascript - Bootstrap 3 日期选择器 minDate 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45552750/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com