Lines 85-114
Link Here
|
85 |
onChange: function( selectedDates, dateText, instance) { |
85 |
onChange: function( selectedDates, dateText, instance) { |
86 |
var thisInput = instance.input; |
86 |
var thisInput = instance.input; |
87 |
let accepts_time = $(thisInput).data('flatpickr-enable-time'); |
87 |
let accepts_time = $(thisInput).data('flatpickr-enable-time'); |
88 |
if ( accepts_time ) { |
88 |
let accepts_period = $(thisInput).data('flatpickr-period'); |
89 |
let parsedDate = flatpickr.parseDate(dateText, instance.config.dateFormat); |
89 |
if ( !accepts_period ) { |
90 |
if ( !parsedDate.getHours() ) { |
90 |
if ( accepts_time ) { |
91 |
instance.setDate(selectedDates[0].setHours(23, 59, 0, 0)); |
91 |
let parsedDate = flatpickr.parseDate(dateText, instance.config.dateFormat); |
|
|
92 |
if ( !parsedDate.getHours() ) { |
93 |
instance.setDate(selectedDates[0].setHours(23, 59, 0, 0)); |
94 |
} |
92 |
} |
95 |
} |
93 |
} |
96 |
} |
94 |
}, |
97 |
}, |
95 |
onOpen: function( selectedDates, dateText, instance ) { |
98 |
onOpen: function( selectedDates, dateText, instance ) { |
96 |
var thisInput = instance.input; |
99 |
var thisInput = instance.input; |
97 |
let accepts_time = $(thisInput).data('flatpickr-enable-time'); |
100 |
let accepts_time = $(thisInput).data('flatpickr-enable-time'); |
|
|
101 |
let accepts_period = $(thisInput).data('flatpickr-period'); |
98 |
let options = {}; |
102 |
let options = {}; |
99 |
if ( accepts_time ) { |
103 |
if ( !accepts_period ) { |
100 |
options = maskitoDateTimeOptionsGenerator({ |
104 |
if ( accepts_time ) { |
101 |
dateMode: altinput_dateformat, |
105 |
options = maskitoDateTimeOptionsGenerator({ |
102 |
timeMode: 'HH:MM', |
106 |
dateMode: altinput_dateformat, |
103 |
dateSeparator: delimiter, |
107 |
timeMode: 'HH:MM', |
104 |
}); |
108 |
dateSeparator: delimiter, |
105 |
} else { |
109 |
}); |
106 |
options = maskitoDateOptionsGenerator({ |
110 |
} else { |
107 |
mode: altinput_dateformat, |
111 |
options = maskitoDateOptionsGenerator({ |
108 |
separator: delimiter, |
112 |
mode: altinput_dateformat, |
109 |
}); |
113 |
separator: delimiter, |
|
|
114 |
}); |
115 |
} |
116 |
new Maskito( instance.altInput, options ); |
110 |
} |
117 |
} |
111 |
new Maskito( instance.altInput, options ); |
|
|
112 |
}, |
118 |
}, |
113 |
onClose: function( selectedDates, dateText, instance) { |
119 |
onClose: function( selectedDates, dateText, instance) { |
114 |
validate_date( dateText, instance ); |
120 |
validate_date( dateText, instance ); |
115 |
- |
|
|