问题描述
我通过在项目中导入 Eonasdan datetimepicker version : 4.17.47 来使用 this JS file。
此外,我正在使用一些自定义验证来确保当用户输入与预期不同的时间范围时显示红色文本。我没有设置 minDate
或 maxDate
,因为时间范围是动态的,可以更改。
有时,用户无法通过单击向上箭头键来增加小时/分钟。 datetimepicker
设置为仅使用一次,因此初始化为:
$("#timePicker").datetimepicker({
format: "LT",allowInputToggle: true,keepInvalid: true // the up arrow icon was not working,so I thought this will fix it but it didn't
});
和模板:
<div class="form-group col-sm-6 time-block">
<div class="control input-group customtextInput" id="timePicker">
<input type="text" id="stime" name="time" class="inputText col-md-12 form-control time-picker"
data-bind="event:{ blur: function (data,event) {$parent.handleDateTimeOnblur.bind(data,$parent,event)() } }"
required />
<span class="input-group-addon">
...
</span>
</div>
<p class="text-danger login-error-msg time-empty" id="time-error" aria-label="Error Message"
data-bind="text: $parent.timeErrorMessage()" role="alert"></p>
</div>
您可以看到演示here
我注意到当用户尝试使用 datetimepicker 转到下一个日期时,它停止递增,(此给定页面上的日期选择器未连接,它们单独初始化。)
对此的任何帮助将不胜感激!
解决方法
我们现在修复了这个问题。见Discussion on GitHub