Skip to content

Commit

Permalink
fix error with time-picker when allowInput is true
Browse files Browse the repository at this point in the history
  • Loading branch information
zeezo887 authored and ifox committed May 23, 2024
1 parent e8e0cae commit fbb7144
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit fbb7144

Please sign in to comment.