Bug 35014: Only set time for enable-time flatpickr
This patch adds a check to the onChange function such that we only attempt to set the default time on change for time enabled flatpickrs when the date is entered manually. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
69a19fb526
commit
5b25b26f70
1 changed files with 7 additions and 3 deletions
|
@ -71,9 +71,13 @@
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onChange: function( selectedDates, dateText, instance) {
|
onChange: function( selectedDates, dateText, instance) {
|
||||||
let parsedDate = flatpickr.parseDate(dateText, instance.config.dateFormat);
|
var thisInput = instance.input;
|
||||||
if ( !parsedDate.getHours() ) {
|
let = accepts_time = $(thisInput).data('flatpickr-enable-time');
|
||||||
instance.setDate(selectedDates[0].setHours(23, 59, 0, 0));
|
if ( accepts_time ) {
|
||||||
|
let parsedDate = flatpickr.parseDate(dateText, instance.config.dateFormat);
|
||||||
|
if ( !parsedDate.getHours() ) {
|
||||||
|
instance.setDate(selectedDates[0].setHours(23, 59, 0, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClose: function( selectedDates, dateText, instance) {
|
onClose: function( selectedDates, dateText, instance) {
|
||||||
|
|
Loading…
Reference in a new issue