From ffea3c6b68cda119f175f1294f7ad9c9152a452c Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Thu, 6 Jun 2024 17:41:00 +0200 Subject: [PATCH] fix time picker messing up the date when number exceeds 24 hours --- resources/js/Components/Common/TimePicker.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/Components/Common/TimePicker.vue b/resources/js/Components/Common/TimePicker.vue index 1aa7a9b6..2fc0c8c6 100644 --- a/resources/js/Components/Common/TimePicker.vue +++ b/resources/js/Components/Common/TimePicker.vue @@ -29,7 +29,7 @@ function updateMinutes(event: Event) { const newValue = target.value; if (!isNaN(parseInt(newValue))) { model.value = getLocalizedDayJs(model.value) - .set('minutes', parseInt(newValue)) + .set('minutes', Math.min(parseInt(newValue), 59)) .utc() .format(); } @@ -40,7 +40,7 @@ function updateHours(event: Event) { const newValue = target.value; if (!isNaN(parseInt(newValue))) { model.value = getLocalizedDayJs(model.value) - .set('hours', parseInt(newValue)) + .set('hours', Math.min(parseInt(newValue), 23)) .utc() .format(); }