From 7440f24931fb3154dba12f662a449ab0e1033569 Mon Sep 17 00:00:00 2001 From: Olayinka Azeez Date: Thu, 2 May 2024 14:34:12 +0100 Subject: [PATCH] fix error with time-picker when allowInput is true --- frontend/js/components/DatePicker.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/js/components/DatePicker.vue b/frontend/js/components/DatePicker.vue index 736e6c192..e4f9fd3a5 100644 --- a/frontend/js/components/DatePicker.vue +++ b/frontend/js/components/DatePicker.vue @@ -160,6 +160,11 @@ return parse(date, fullFormatNoTime, Date.UTC()); } + if (self.isValidTime(date)) { + const currentDate = new Date(); + date = `${currentDate.toDateString()} ${date}`; + } + // Hope for the best.. return new Date(date); }, @@ -209,6 +214,10 @@ this.saveIntoStore() this.$emit('input', this.date) + }, + isValidTime: function (string) { + const timeRegex = /^(0?[1-9]|1[0-2]):[0-5][0-9](?: (AM|PM))?$/i; + return timeRegex.test(string); } }, mounted: function () {