adds conversions for oct-dec

This commit is contained in:
MinamiFunakoshiTR 2025-08-12 09:53:10 -04:00
parent a76415b156
commit bf7203eb71
Failed to extract signature
2 changed files with 29 additions and 0 deletions

View file

@ -114,6 +114,18 @@ describe('Utils tests', () => {
const unformattedSept = 'Sep. 2025';
const formattedSept = 'Sept. 2025';
expect(prettifyDate(unformattedSept)).toBe(formattedSept);
const unformattedOct = 'Oct. 2025';
const formattedOct = 'Oct. 2025';
expect(prettifyDate(unformattedOct)).toBe(formattedOct);
const unformattedNov = 'Nov 2025';
const formattedNov = 'Nov. 2025';
expect(prettifyDate(unformattedNov)).toBe(formattedNov);
const unformattedDec = 'DEC 2025';
const formattedDec = 'Dec. 2025';
expect(prettifyDate(unformattedDec)).toBe(formattedDec);
});
it('should fix spacing between time and am/pm', () => {
@ -133,9 +145,18 @@ describe('Utils tests', () => {
const formattedJune = 'June 1, 2023, 10:00 a.m.';
expect(prettifyDate(unformattedJune)).toBe(formattedJune);
const unformattedAug = 'aug 1, 2023, 10:00PM';
const formattedAug = 'Aug. 1, 2023, 10:00 p.m.';
expect(prettifyDate(unformattedAug)).toBe(formattedAug);
const unformattedSept = 'sep. 1, 2023, 10:00PM';
const formattedSept = 'Sept. 1, 2023, 10:00 p.m.';
expect(prettifyDate(unformattedSept)).toBe(formattedSept);
const unformattedOct = 'oct 1, 2023, 10:00PM';
const formattedOct = 'Oct. 1, 2023, 10:00 p.m.';
expect(prettifyDate(unformattedOct)).toBe(formattedOct);
});
it('should work with lower or upper case', () => {
@ -154,5 +175,9 @@ describe('Utils tests', () => {
const unformattedJune = 'JUN. 1, 2023, 10:00AM';
const formattedJune = 'June 1, 2023, 10:00 a.m.';
expect(prettifyDate(unformattedJune)).toBe(formattedJune);
const unformattedAug = 'AUG. 1, 2023, 10:00PM';
const formattedAug = 'Aug. 1, 2023, 10:00 p.m.';
expect(prettifyDate(unformattedAug)).toBe(formattedAug);
});
});

View file

@ -52,7 +52,11 @@ export const prettifyDate = (input: string) => {
apr: 'April',
jun: 'June',
jul: 'July',
aug: 'Aug.',
sep: 'Sept.',
oct: 'Oct.',
nov: 'Nov.',
dec: 'Dec.',
};
// If the key in conversions is found in the input (case insensitive), replace it with the corresponding value