Merge pull request #4902 from rstainsby/patch-2

#4901 - parse date when in time-only mode
pull/4925/head
Tuğçe Küçükoğlu 2023-12-01 11:56:53 +03:00 committed by GitHub
commit deceff6e82
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,14 +1272,10 @@ export default {
let formattedValue = null; let formattedValue = null;
if (date) { if (date) {
if (this.timeOnly) { formattedValue = this.formatDate(date, this.datePattern);
formattedValue = this.formatTime(date);
} else {
formattedValue = this.formatDate(date, this.datePattern);
if (this.showTime) { if (this.showTime || this.timeOnly) {
formattedValue += ' ' + this.formatTime(date); formattedValue += ' ' + this.formatTime(date);
}
} }
} }
@ -1798,18 +1794,13 @@ export default {
let date; let date;
let parts = text.split(' '); let parts = text.split(' ');
if (this.timeOnly) { const dateFormat = this.datePattern;
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); date = this.parseDate(parts[0], dateFormat);
this.populateTime(date, parts[1], parts[2]); this.populateTime(date, parts[1], parts[2]);
} else { } else {
date = this.parseDate(text, dateFormat); date = this.parseDate(text, dateFormat);
}
} }
return date; return date;