From 9edb04577dc0941da409563d3e37e3e1dcc8aeed Mon Sep 17 00:00:00 2001 From: Caleb Cox Date: Tue, 17 Sep 2024 15:31:55 -0500 Subject: [PATCH] Change date formatting --- .../FourteenMonthReports/useCsvData.test.ts | 34 +++++++++---------- .../FourteenMonthReports/useCsvData.ts | 8 ++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/components/Reports/FourteenMonthReports/useCsvData.test.ts b/src/components/Reports/FourteenMonthReports/useCsvData.test.ts index c4583447e..2716dd1f5 100644 --- a/src/components/Reports/FourteenMonthReports/useCsvData.test.ts +++ b/src/components/Reports/FourteenMonthReports/useCsvData.test.ts @@ -148,18 +148,18 @@ describe('useCsvData', () => { 'Missing In Hand Monthly Equivalent', 'In Hand Special Gifts', 'In Hand Date Range', - '2020-12-01', - '2020-11-01', - '2020-10-01', - '2020-09-01', - '2020-08-01', - '2020-07-01', - '2020-06-01', - '2020-05-01', - '2020-04-01', - '2020-03-01', - '2020-02-01', - '2020-01-01', + 'Dec 20', + 'Nov 20', + 'Oct 20', + 'Sep 20', + 'Aug 20', + 'Jul 20', + 'Jun 20', + 'May 20', + 'Apr 20', + 'Mar 20', + 'Feb 20', + 'Jan 20', 'Total (last month excluded from total)', ], [ @@ -172,7 +172,7 @@ describe('useCsvData', () => { 150, -0, 500, - '4/20 - 1/20', + 'Jan 20 - Apr 20', 0, 0, 0, @@ -197,7 +197,7 @@ describe('useCsvData', () => { 75, -25, 0, - '12/20 - 1/20', + 'Jan 20 - Dec 20', 0, 100, 0, @@ -249,9 +249,9 @@ describe('useCsvData', () => { 'Missing In Hand Monthly Equivalent', 'In Hand Special Gifts', 'In Hand Date Range', - '2020-03-01', - '2020-02-01', - '2020-01-01', + 'Mar 20', + 'Feb 20', + 'Jan 20', 'Total (last month excluded from total)', ], ['Totals', '', '', '', '', 0, 0, 0, 0, '', 100, 200, 150, 450], diff --git a/src/components/Reports/FourteenMonthReports/useCsvData.ts b/src/components/Reports/FourteenMonthReports/useCsvData.ts index d580b5081..235648796 100644 --- a/src/components/Reports/FourteenMonthReports/useCsvData.ts +++ b/src/components/Reports/FourteenMonthReports/useCsvData.ts @@ -9,7 +9,7 @@ export type CsvData = (string | number)[][]; const formatMonth = (month: string, locale: string): string => DateTime.fromISO(month).toJSDate().toLocaleDateString(locale, { - month: 'numeric', + month: 'short', year: '2-digit', }); @@ -43,7 +43,7 @@ export const useCsvData = (currencyTables: CurrencyTable[]): CsvData => { t('Missing In Hand Monthly Equivalent'), t('In Hand Special Gifts'), t('In Hand Date Range'), - ...totals.map(({ month }) => month), + ...totals.map(({ month }) => formatMonth(month, locale)), t('Total (last month excluded from total)'), ], ]; @@ -77,10 +77,10 @@ export const useCsvData = (currencyTables: CurrencyTable[]): CsvData => { : ''; const inHandDateRange = inHandMonthlyEquivalent - ? `${formatMonth(inHandMonths[0].month, locale)} - ${formatMonth( + ? `${formatMonth( inHandMonths[inHandMonths.length - 1].month, locale, - )}` + )} - ${formatMonth(inHandMonths[0].month, locale)}` : ''; return [