diff --git a/packages/forms/resources/views/components/date-time-picker.blade.php b/packages/forms/resources/views/components/date-time-picker.blade.php index 87e010c8df..a7e9c04995 100644 --- a/packages/forms/resources/views/components/date-time-picker.blade.php +++ b/packages/forms/resources/views/components/date-time-picker.blade.php @@ -187,7 +187,17 @@ }) this.$watch('hour', () => { - this.hour = Number.isInteger(+this.hour) && this.hour >= 0 && this.hour < 24 ? +this.hour : dayjs().hour() + let hour = +this.hour + + if (! Number.isInteger(hour) || hour > 23) { + this.hour = 0 + this.focusNextDay() + } else if (hour < 0) { + this.hour = 23 + this.focusPreviousDay() + } else { + this.hour = hour + } let date = this.getSelectedDate() @@ -197,7 +207,17 @@ }) this.$watch('minute', () => { - this.minute = Number.isInteger(+this.minute) && this.minute >= 0 && this.minute < 60 ? +this.minute : dayjs().minute() + let minute = +this.minute + + if (! Number.isInteger(minute) || minute > 59) { + this.minute = 0 + this.hour++ + } else if (minute < 0) { + this.minute = 59 + this.hour-- + } else { + this.minute = minute + } let date = this.getSelectedDate() @@ -207,7 +227,17 @@ }) this.$watch('second', () => { - this.second = Number.isInteger(+this.second) && this.second >= 0 && this.second < 60 ? +this.second : dayjs().second() + let second = +this.second + + if (! Number.isInteger(second) || second > 59) { + this.second = 0 + this.minute++ + } else if (second < 0) { + this.second = 59 + this.minute-- + } else { + this.second = second + } let date = this.getSelectedDate() @@ -466,6 +496,8 @@ @if ($formComponent->hasTime())
: :