From 4f963d53e7a85e2352d27d167898a56fd57eb44c Mon Sep 17 00:00:00 2001 From: Michaela Brydon Date: Mon, 16 Oct 2023 16:14:25 -0400 Subject: [PATCH] Removing custom date formatting --- .../duplicate-check/duplicate-check.spec.js | 8 ++++---- .../duplicate-check/duplicate-check.vue | 19 +++---------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/layouts/duplicate-check/duplicate-check.spec.js b/src/layouts/duplicate-check/duplicate-check.spec.js index 1295bf61..f9138fe9 100644 --- a/src/layouts/duplicate-check/duplicate-check.spec.js +++ b/src/layouts/duplicate-check/duplicate-check.spec.js @@ -163,7 +163,7 @@ describe('duplicateCheck.vue', () => { main: mainInitialState } })]; - const expectedSubtext = '11/01/2004'; + const expectedSubtext = '11/1/2004'; const wrapper = shallowMount(duplicateCheck, mountOptions); @@ -189,7 +189,7 @@ describe('duplicateCheck.vue', () => { vehicleYear: getRandomString(6, 6), vehicleMake: getRandomString(6, 6), vehicleModel: null, - responseDate: '1999-02-30T01:12:34', + responseDate: '1999-01-15T01:12:34', referralNumber } ] @@ -200,7 +200,7 @@ describe('duplicateCheck.vue', () => { main: mainInitialState } })]; - const expectedSubtext = '2/30/1999'; + const expectedSubtext = '1/15/1999'; const wrapper = shallowMount(duplicateCheck, mountOptions); @@ -238,7 +238,7 @@ describe('duplicateCheck.vue', () => { } })]; const expectedVehicle = 'Year Make Model'; - const expectedDate = '3/01/2018'; + const expectedDate = '3/1/2018'; const wrapper = shallowMount(duplicateCheck, mountOptions); diff --git a/src/layouts/duplicate-check/duplicate-check.vue b/src/layouts/duplicate-check/duplicate-check.vue index 56e888cc..222309ec 100644 --- a/src/layouts/duplicate-check/duplicate-check.vue +++ b/src/layouts/duplicate-check/duplicate-check.vue @@ -105,9 +105,10 @@ export default { ? `${o.vehicleYear} ${o.vehicleMake} ${o.vehicleModel}` : null; + const dateOfLoss = o.responseDate == null ? '' : new Date(o.responseDate).toLocaleDateString(); const subtext = vehicle && o.responseDate - ? `${vehicle}, ${this.getDateMinusTime(o.responseDate)}` - : (vehicle ?? '').concat(this.getDateMinusTime(o.responseDate ?? '')); + ? `${vehicle}, ${dateOfLoss}` + : (vehicle ?? '').concat(dateOfLoss); return { Text: duplicateOrderText, @@ -159,20 +160,6 @@ export default { this.$route ); } - }, - /** - * @param date date string in YYYY-MM-DDTHH:mm:ss format. - * @summary Converts a date string from YYYY-MM-DDTHH:mm:ss to M-DD-YYYY - */ - getDateMinusTime(date) { - if (!date) { return ''; } - const yyyyMmDd = date.substring(0, 10).split('-'); - const year = yyyyMmDd[0]; - const month = yyyyMmDd[1][0] === '0' - ? yyyyMmDd[1][1] - : yyyyMmDd[1]; - const day = yyyyMmDd[2]; - return `${month}/${day}/${year}`; } } };