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