From c4757ee8a9d5dba29c4bcd9bfef666d47c96e5bc Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Tue, 18 Jun 2024 13:03:37 +0200 Subject: [PATCH] validate if date is valid before updating the value to prevent invalid dates sent to the server, fixes ST-255 --- resources/js/Components/Common/DatePicker.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/Components/Common/DatePicker.vue b/resources/js/Components/Common/DatePicker.vue index d8317789..e1eddd3e 100644 --- a/resources/js/Components/Common/DatePicker.vue +++ b/resources/js/Components/Common/DatePicker.vue @@ -18,7 +18,7 @@ function updateDate(event: Event) { const target = event.target as HTMLInputElement; const newValue = target.value; const newDate = getDayJsInstance()(newValue); - if (newDate) { + if (newDate.isValid()) { model.value = getLocalizedDayJs(model.value) .set('year', newDate.year()) .set('month', newDate.month())