From a6053c6dbcbd9b1dc64dba46e9b3ffa285849aeb Mon Sep 17 00:00:00 2001 From: Vladimir Verstov Date: Tue, 7 Mar 2023 19:49:04 +0700 Subject: [PATCH] Fix DatePicker's range mode normalizeValue behavior --- src/components/DatePicker.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue index 3ca80301a..2aac5167a 100644 --- a/src/components/DatePicker.vue +++ b/src/components/DatePicker.vue @@ -635,18 +635,18 @@ export default { if (!this.hasValue(value)) return null; if (this.isRange) { const result = {}; - const start = value.start > value.end ? value.end : value.start; - result.start = this.normalizeDate(start, { + const normalizedStart = this.normalizeDate(value.start, { ...config[0], fillDate: (this.value_ && this.value_.start) || config[0].fillDate, patch, }); - const end = value.start > value.end ? value.start : value.end; - result.end = this.normalizeDate(end, { + const normalizedEnd = this.normalizeDate(value.end, { ...config[1], fillDate: (this.value_ && this.value_.end) || config[1].fillDate, patch, }); + result.start = normalizedStart.getTime() > normalizedEnd.getTime() ? normalizedEnd : normalizedStart; + result.end = normalizedStart.getTime() > normalizedEnd.getTime() ? normalizedStart : normalizedEnd; return this.sortRange(result, rangePriority); } return this.normalizeDate(value, {