From 3a911d1fb6af9b747867a11371483fe0a6b02fc3 Mon Sep 17 00:00:00 2001 From: Ryan Stainsby <30803531+rstainsby@users.noreply.github.com> Date: Thu, 30 Nov 2023 19:43:59 +1000 Subject: [PATCH] parse date when in time-only mode --- components/lib/calendar/Calendar.vue | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/components/lib/calendar/Calendar.vue b/components/lib/calendar/Calendar.vue index b65804051..80043b4e5 100755 --- a/components/lib/calendar/Calendar.vue +++ b/components/lib/calendar/Calendar.vue @@ -1272,14 +1272,10 @@ export default { let formattedValue = null; if (date) { - if (this.timeOnly) { - formattedValue = this.formatTime(date); - } else { - formattedValue = this.formatDate(date, this.datePattern); + formattedValue = this.formatDate(date, this.datePattern); - if (this.showTime) { - formattedValue += ' ' + this.formatTime(date); - } + if (this.showTime || this.timeOnly) { + formattedValue += ' ' + this.formatTime(date); } } @@ -1798,18 +1794,13 @@ export default { let date; let parts = text.split(' '); - if (this.timeOnly) { - date = new Date(); - this.populateTime(date, parts[0], parts[1]); - } else { - const dateFormat = this.datePattern; + const dateFormat = this.datePattern; - if (this.showTime) { - date = this.parseDate(parts[0], dateFormat); - this.populateTime(date, parts[1], parts[2]); - } else { - date = this.parseDate(text, dateFormat); - } + if (this.showTime || this.timeOnly) { + date = this.parseDate(parts[0], dateFormat); + this.populateTime(date, parts[1], parts[2]); + } else { + date = this.parseDate(text, dateFormat); } return date;