From b8de6b2749bfbb14c484ed2b3db9d71c3de185be Mon Sep 17 00:00:00 2001 From: Patrick Keenan Date: Mon, 2 Jan 2023 22:52:44 -0500 Subject: [PATCH 1/4] Bug fix for inputing prior year dates --- src/components/DatePicker.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue index 3ca80301a..35593b359 100644 --- a/src/components/DatePicker.vue +++ b/src/components/DatePicker.vue @@ -635,13 +635,13 @@ export default { if (!this.hasValue(value)) return null; if (this.isRange) { const result = {}; - const start = value.start > value.end ? value.end : value.start; + const start = Date(value.start) > Date(value.end) ? value.end : value.start; result.start = this.normalizeDate(start, { ...config[0], fillDate: (this.value_ && this.value_.start) || config[0].fillDate, patch, }); - const end = value.start > value.end ? value.start : value.end; + const end = Date(value.start) > Date(value.end) ? value.start : value.end; result.end = this.normalizeDate(end, { ...config[1], fillDate: (this.value_ && this.value_.end) || config[1].fillDate, From e1dd59c73e33404724d01258784a095b251e9484 Mon Sep 17 00:00:00 2001 From: Patrick Keenan Date: Tue, 3 Jan 2023 10:01:41 -0500 Subject: [PATCH 2/4] Bug fix for inputing prior year dates --- src/components/DatePicker.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue index 35593b359..1652b2687 100644 --- a/src/components/DatePicker.vue +++ b/src/components/DatePicker.vue @@ -635,18 +635,19 @@ export default { if (!this.hasValue(value)) return null; if (this.isRange) { const result = {}; - const start = Date(value.start) > Date(value.end) ? value.end : value.start; + const start = new Date(value.start).getTime() > new Date(value.end).getTime() ? value.end : value.start; result.start = this.normalizeDate(start, { ...config[0], fillDate: (this.value_ && this.value_.start) || config[0].fillDate, patch, }); - const end = Date(value.start) > Date(value.end) ? value.start : value.end; + const end = new Date(value.start).getTime() > new Date(value.end).getTime() > 0 ? value.start : value.end; result.end = this.normalizeDate(end, { ...config[1], fillDate: (this.value_ && this.value_.end) || config[1].fillDate, patch, }); + console.log(start, end, result); return this.sortRange(result, rangePriority); } return this.normalizeDate(value, { From 36fe405d4f3003555451fba2542434dc1dfec674 Mon Sep 17 00:00:00 2001 From: Patrick Keenan Date: Tue, 3 Jan 2023 10:02:55 -0500 Subject: [PATCH 3/4] Use getTime to correctly compare all cases --- src/components/DatePicker.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue index 1652b2687..05b5ab6a7 100644 --- a/src/components/DatePicker.vue +++ b/src/components/DatePicker.vue @@ -641,7 +641,7 @@ export default { fillDate: (this.value_ && this.value_.start) || config[0].fillDate, patch, }); - const end = new Date(value.start).getTime() > new Date(value.end).getTime() > 0 ? value.start : value.end; + const end = new Date(value.start).getTime() > new Date(value.end).getTime() ? value.start : value.end; result.end = this.normalizeDate(end, { ...config[1], fillDate: (this.value_ && this.value_.end) || config[1].fillDate, From bbd34d51dd8841394bca31870597078a4d62b757 Mon Sep 17 00:00:00 2001 From: Patrick Keenan Date: Tue, 3 Jan 2023 10:03:41 -0500 Subject: [PATCH 4/4] Remove console.logs --- src/components/DatePicker.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue index 05b5ab6a7..c1eb57ddb 100644 --- a/src/components/DatePicker.vue +++ b/src/components/DatePicker.vue @@ -647,7 +647,6 @@ export default { fillDate: (this.value_ && this.value_.end) || config[1].fillDate, patch, }); - console.log(start, end, result); return this.sortRange(result, rangePriority); } return this.normalizeDate(value, {