mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Fixed: today button dbl click didn't validate date
The today (home) button show the current month. After the double click it selected the current date and closed the popup, not validating the current date against the specified minimum and maximum dates. Now, if the current date is out of the allowed range, the popup stays visible, and the input value is not changed.
This commit is contained in:
parent
084332229e
commit
5ef92c20e1
@ -1325,6 +1325,18 @@
|
|||||||
_xdsoft_datetime.setCurrentTime(0);
|
_xdsoft_datetime.setCurrentTime(0);
|
||||||
datetimepicker.trigger('afterOpen.xdsoft');
|
datetimepicker.trigger('afterOpen.xdsoft');
|
||||||
}).on('dblclick.xdsoft', function () {
|
}).on('dblclick.xdsoft', function () {
|
||||||
|
var currentDate = _xdsoft_datetime.getCurrentTime();
|
||||||
|
currentDate = new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate());
|
||||||
|
var minDate = _xdsoft_datetime.strtodate(options.minDate);
|
||||||
|
minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
|
||||||
|
if(currentDate < minDate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var maxDate = _xdsoft_datetime.strtodate(options.maxDate);
|
||||||
|
maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate());
|
||||||
|
if(currentDate > maxDate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
input.val(_xdsoft_datetime.str());
|
input.val(_xdsoft_datetime.str());
|
||||||
datetimepicker.trigger('close.xdsoft');
|
datetimepicker.trigger('close.xdsoft');
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user