Skip to content

Commit

Permalink
Change date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Sep 19, 2024
1 parent 70f8b88 commit 9edb045
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
34 changes: 17 additions & 17 deletions src/components/Reports/FourteenMonthReports/useCsvData.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
],
[
Expand All @@ -172,7 +172,7 @@ describe('useCsvData', () => {
150,
-0,
500,
'4/20 - 1/20',
'Jan 20 - Apr 20',
0,
0,
0,
Expand All @@ -197,7 +197,7 @@ describe('useCsvData', () => {
75,
-25,
0,
'12/20 - 1/20',
'Jan 20 - Dec 20',
0,
100,
0,
Expand Down Expand Up @@ -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],
Expand Down
8 changes: 4 additions & 4 deletions src/components/Reports/FourteenMonthReports/useCsvData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});

Expand Down Expand Up @@ -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)'),
],
];
Expand Down Expand Up @@ -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 [
Expand Down

0 comments on commit 9edb045

Please sign in to comment.