Reputation: 3
Here is the lib that i'm using : 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.
But by using handleDtpicker like :
$('#datetimepicker').handleDtpicker({ minDate: '2014/07/02' });
I have this error : Uncaught TypeError: Cannot read property 'apply' of undefined
Is there any solution to set a min or a max date ?
Thanks
Upvotes: 0
Views: 2956
Reputation: 1249
Just add the minDate like you set the maxDate (JSFiddle code):
$('#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):
$('.toRestrictDate').click(function()
{
$('#datetimepicker').handleDtpicker('destroy');
$('#datetimepicker').appendDtpicker({
maxDate : '2014/07/13',
minDate: '2014/07/8'
});
});
Upvotes: 1