Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error with time-picker when allowInput is true #2576

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/js/components/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down Expand Up @@ -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 () {
Expand Down