Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4901 - parse date when in time-only mode #4902

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions components/lib/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1272,14 +1272,10 @@ export default {
let formattedValue = null;

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) {
formattedValue += ' ' + this.formatTime(date);
}
if (this.showTime || this.timeOnly) {
formattedValue += ' ' + this.formatTime(date);
}
}

Expand Down Expand Up @@ -1798,18 +1794,13 @@ 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;
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);
}
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;
Expand Down
Loading