Fixed #4952 - Calendar: Time only mode does not work

pull/4956/head
tugcekucukoglu 2023-12-11 13:20:45 +03:00
parent 296b5d7bfa
commit c4a7af7b05
1 changed files with 18 additions and 9 deletions

View File

@ -1272,12 +1272,16 @@ export default {
let formattedValue = null; let formattedValue = null;
if (date) { 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 || this.timeOnly) { if (this.showTime) {
formattedValue += ' ' + this.formatTime(date); formattedValue += ' ' + this.formatTime(date);
} }
} }
}
return formattedValue; return formattedValue;
}, },
@ -1798,14 +1802,19 @@ export default {
let date; let date;
let parts = text.split(' '); let parts = text.split(' ');
if (this.timeOnly) {
date = new Date(this.modelValue);
this.populateTime(date, parts[0], parts[1]);
} else {
const dateFormat = this.datePattern; const dateFormat = this.datePattern;
if (this.showTime || this.timeOnly) { if (this.showTime) {
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;
}, },