Skip to content

Commit 106cce9

Browse files
committed
Include test for parsing UTC-5 to UTC
1 parent df95339 commit 106cce9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

shared/tests/dates.test.js

+13
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ describe('convertDateToString', () => {
1616
expect(formattedDate4).toBe('February the 3rd of 2025');
1717
});
1818

19+
it('returns the correctly parsed UTC date for a non-UTC timestamp', () => {
20+
const date = '2025-02-02T20:40:16.000-05:00';
21+
const formattedDate1 = convertDateToString(date, outputFormat);
22+
const formattedDate2 = convertDateToString(date, 'DD-MM-YYYY');
23+
const formattedDate3 = convertDateToString(date, 'MMM D, YYYY');
24+
const formattedDate4 = convertDateToString(date, 'MMMM [the] Do [of] YYYY');
25+
26+
expect(formattedDate1).toBe('Feb 3, 2025 at 1:40:16 am UTC');
27+
expect(formattedDate2).toBe('03-02-2025');
28+
expect(formattedDate3).toBe('Feb 3, 2025');
29+
expect(formattedDate4).toBe('February the 3rd of 2025');
30+
});
31+
1932
it('returns a formatted string AM (English)', () => {
2033
const date = '2021-11-30T09:51:28.000Z';
2134
const formattedDate = convertDateToString(date, outputFormat, {

0 commit comments

Comments
 (0)