parse date when in time-only mode

pull/4902/head
Ryan Stainsby 2023-11-30 19:43:59 +10:00 committed by GitHub
parent c42948530e
commit 3a911d1fb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 18 deletions

View File

@ -1272,16 +1272,12 @@ export default {
let formattedValue = null;
if (date) {
if (this.timeOnly) {
formattedValue = this.formatTime(date);
} else {
formattedValue = this.formatDate(date, this.datePattern);
if (this.showTime) {
if (this.showTime || this.timeOnly) {
formattedValue += ' ' + this.formatTime(date);
}
}
}
return formattedValue;
},
@ -1798,19 +1794,14 @@ 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;
if (this.showTime) {
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;
},