admin管理员组文章数量:1402812
I'm using time picker to select only time in my app. The problem is that I need to set min and max time limits from the string. For example I have:
var min = '10:15:12';
var max = '19:15:12';
How to properly create date from it and append limits to already initialized time picker ?
I'm using time picker to select only time in my app. The problem is that I need to set min and max time limits from the string. For example I have:
var min = '10:15:12';
var max = '19:15:12';
How to properly create date from it and append limits to already initialized time picker ?
Share Improve this question asked Mar 26, 2015 at 7:21 user1692333user1692333 2,5976 gold badges35 silver badges66 bronze badges2 Answers
Reset to default 2 jQuery('#picker').timepicker({min: '8:00 am', max: '8:00 pm'})
or
var picker=jQuery('#picker');
var min = '10:15:12 am';
var max = '07:15:12 pm';
picker.timepicker('option','min',min);
picker.timepicker('option','max',max);
you have another example:
$('#picker').datetimepicker({
minDate: new Date(2010, 11, 20, 8, 30),
maxDate: new Date(2010, 11, 31, 19, 30)
});
I think you have to set these options:
hourMin
Default: 0 - The minimum hour allowed for all dates.
minuteMin
Default: 0 - The minimum minute allowed for all dates.
secondMin
Default: 0 - The minimum second allowed for all dates.
millisecMin
Default: 0 - The minimum millisecond allowed for all dates.
microsecMin
Default: 0 - The minimum microsecond allowed for all dates.
hourMax
Default: 23 - The maximum hour allowed for all dates.
minuteMax
Default: 59 - The maximum minute allowed for all dates.
secondMax
Default: 59 - The maximum second allowed for all dates.
millisecMax
Default: 999 - The maximum millisecond allowed for all dates.
microsecMax
Default: 999 - The maximum microsecond allowed for all dates.
Ref: http://trentrichardson./examples/timepicker/ --> Time Field Options
本文标签: javascriptHow to set minimum and maximum time in timepickerStack Overflow
版权声明:本文标题:javascript - How to set minimum and maximum time in timepicker? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744337708a2601288.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论