validate if date is valid before updating the value to prevent invalid dates sent to the server, fixes ST-255

This commit is contained in:
Gregor Vostrak
2024-06-18 13:03:37 +02:00
parent c0212ec836
commit c4757ee8a9

View File

@@ -18,7 +18,7 @@ function updateDate(event: Event) {
const target = event.target as HTMLInputElement; const target = event.target as HTMLInputElement;
const newValue = target.value; const newValue = target.value;
const newDate = getDayJsInstance()(newValue); const newDate = getDayJsInstance()(newValue);
if (newDate) { if (newDate.isValid()) {
model.value = getLocalizedDayJs(model.value) model.value = getLocalizedDayJs(model.value)
.set('year', newDate.year()) .set('year', newDate.year())
.set('month', newDate.month()) .set('month', newDate.month())