diff --git a/apps-rendering/src/date.test.ts b/apps-rendering/src/date.test.ts index 7175329d09d..b6b3963a2d0 100644 --- a/apps-rendering/src/date.test.ts +++ b/apps-rendering/src/date.test.ts @@ -82,13 +82,13 @@ describe('fromString', () => { describe('formatLocal', () => { test('returns correct local time zone (local timezone is Europe/London set in TZ global variable)', () => { expect(formatLocal(new Date('2020-03-11T17:25:00'))).toBe( - 'Wed 11 Mar 2020 17.25 (Greenwich Mean Time)', + 'Wed 11 Mar 2020 17.25 GMT', ); }); test('returns Europe/London local time for non UTC time', () => { expect(formatLocal(new Date('2012/02/10 10:10:30 +0180'))).toBe( - 'Fri 10 Feb 2012 07.50 (Greenwich Mean Time)', + 'Fri 10 Feb 2012 07.50 GMT', ); }); }); diff --git a/apps-rendering/src/date.ts b/apps-rendering/src/date.ts index f57bf3593a0..d365dcb96d0 100644 --- a/apps-rendering/src/date.ts +++ b/apps-rendering/src/date.ts @@ -155,9 +155,6 @@ const localTime12Hr = (date: Date): string => .replace(':', '.') .toLowerCase(); -const localTimeZone = (date: Date): string => - /\(.*?\)$/.exec(date.toTimeString())?.pop() ?? ''; - const localTimeZoneAbbr = (date: Date): string => /([^\s]+)$/ .exec(date.toLocaleString([], { timeZoneName: 'short' })) @@ -176,7 +173,7 @@ const fullyFormat = (date: Date): string => const formatLocal = (date: Date): string => `${localDay(date)} ${date.getDate()} ${localMonth( date, - )} ${date.getFullYear()} ${localTime(date)} ${localTimeZone(date)}`; + )} ${date.getFullYear()} ${localTime(date)} ${localTimeZoneAbbr(date)}`; const formatLocalTimeDateTz = (date: Date): string => `${localTime12Hr(date)} ${date.getDate()} ${localMonth(