-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue where time won't change from 12:00 on first attempt #2342
Comments
I'm also experiencing this. From what I can tell, this still occurs with flatpickr versions However, still using version |
I found a sort of ugly work around by modifying the This is what I did: /**
* The handler for all events targeting the time inputs
*/
function updateTime(e) {
// starting my edit
if (self.selectedDates.length === 0 && self.hourElement.value !== undefined) {
var defaultDate = self.config.minDate !== undefined
? new Date(self.config.minDate.getTime())
: new Date();
defaultDate.setHours(self.hourElement.value, self.minuteElement.value, 0, 0);
self.setDate(defaultDate, false);
}
// ending my edit
else if (self.selectedDates.length === 0) {
var defaultDate = self.config.minDate !== undefined
? new Date(self.config.minDate.getTime())
: new Date();
var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;
defaultDate.setHours(hours, minutes, seconds, 0);
self.setDate(defaultDate, false);
}
if (e !== undefined && e.type !== "blur") {
timeWrapper(e);
}
var prevValue = self._input.value;
setHoursFromInputs();
updateValue();
if (self._input.value !== prevValue) {
self._debouncedChange();
}
} Here's a fiddle https://jsfiddle.net/fme42zhu/1/ |
The first time the flatpickr loads if you type a time then press enter, then it just resets to 12:00 :/
https://jsfiddle.net/x3nr725c/
The text was updated successfully, but these errors were encountered: