@@ -104,7 +104,7 @@ class DateTimePicker {
104104 }
105105 }
106106
107- onKeyUp(isMinute, event) {
107+ onKeyUp(isHour, isMinute, isSecond , event) {
108108 const inputValue = event.target.value;
109109
110110 if (inputValue.length === 0) {
@@ -120,10 +120,12 @@ class DateTimePicker {
120120 return;
121121 }
122122
123- if (isMinute) {
124- flatpickrDate.setMinutes(value);
125- } else {
123+ if (isHour) {
126124 flatpickrDate.setHours(value);
125+ } else if (isMinute) {
126+ flatpickrDate.setMinutes(value);
127+ } else if (isSecond) {
128+ flatpickrDate.setSeconds(value);
127129 }
128130
129131 if (this.flatpickrInstance.config.minDate?.getTime() > flatpickrDate.getTime()) {
@@ -150,8 +152,9 @@ class DateTimePicker {
150152 );
151153
152154 if (this.flatpickrInstance.config.enableTime) {
153- this.flatpickrInstance.minuteElement.addEventListener('keyup', this.onKeyUp.bind(this, true), false);
154- this.flatpickrInstance.hourElement.addEventListener('keyup', this.onKeyUp.bind(this, false), false);
155+ this.flatpickrInstance.hourElement.addEventListener('keyup', this.onKeyUp.bind(this, true, false, false), false);
156+ this.flatpickrInstance.minuteElement.addEventListener('keyup', this.onKeyUp.bind(this, false, true, false), false);
157+ this.flatpickrInstance.secondElement.addEventListener('keyup', this.onKeyUp.bind(this, false, false, true), false);
155158 }
156159 }
157160}
0 commit comments