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