Skip to content

Commit ffea3c6

Browse files
committed
fix time picker messing up the date when number exceeds 24 hours
1 parent 1fdbfe7 commit ffea3c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

resources/js/Components/Common/TimePicker.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function updateMinutes(event: Event) {
2929
const newValue = target.value;
3030
if (!isNaN(parseInt(newValue))) {
3131
model.value = getLocalizedDayJs(model.value)
32-
.set('minutes', parseInt(newValue))
32+
.set('minutes', Math.min(parseInt(newValue), 59))
3333
.utc()
3434
.format();
3535
}
@@ -40,7 +40,7 @@ function updateHours(event: Event) {
4040
const newValue = target.value;
4141
if (!isNaN(parseInt(newValue))) {
4242
model.value = getLocalizedDayJs(model.value)
43-
.set('hours', parseInt(newValue))
43+
.set('hours', Math.min(parseInt(newValue), 23))
4444
.utc()
4545
.format();
4646
}

0 commit comments

Comments
 (0)