[英]Impossible to set minDate or maxDate in jquery-simple-datetimepicker
Here is the lib that i'm using : http://mugifly.github.io/jquery-simple-datetimepicker 这是我正在使用的lib: http : //mugifly.github.io/jquery-simple-datetimepicker
With the following fiddle : http://jsfiddle.net/3SNEq/2/ , the datetime picker is well set for the minDate or MaxDate when setting up these datas directly in the appendDtpicker method. 使用以下小提琴: http : //jsfiddle.net/3SNEq/2/ ,当直接在appendDtpicker方法中设置这些数据时,为minDate或MaxDate设置了正确的日期时间选择器。
But by using handleDtpicker like : 但是通过使用handleDtpicker像:
$('#datetimepicker').handleDtpicker({ minDate: '2014/07/02' });
I have this error : Uncaught TypeError: Cannot read property 'apply' of undefined 我有此错误:未捕获的TypeError:无法读取未定义的属性“应用”
Is there any solution to set a min or a max date ? 有什么解决方案来设置最小或最大日期?
Thanks 谢谢
Just add the minDate like you set the maxDate ( JSFiddle code ): 就像添加maxDate( JSFiddle代码 )一样添加minDate:
$('#datetimepicker').appendDtpicker({
maxDate : '2014/07/19',
minDate: '2014/07/02'
});
UPDATE: 更新:
To re-specify the min and max date sometime after page loaded, try to do something like this ( JSFiddle code ): 要在页面加载后的某个时间重新指定最小和最大日期,请尝试执行以下操作( JSFiddle代码 ):
$('.toRestrictDate').click(function()
{
$('#datetimepicker').handleDtpicker('destroy');
$('#datetimepicker').appendDtpicker({
maxDate : '2014/07/13',
minDate: '2014/07/8'
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.