From ca95d7275a8fb9852ad7f37ef5ae189d3bdf0527 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Tue, 8 Jul 2025 02:32:18 +0530 Subject: [PATCH] (feat:dateTimeUtils) localise weekday format --- frontend/src/utils/dateTimeUtils.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frontend/src/utils/dateTimeUtils.ts b/frontend/src/utils/dateTimeUtils.ts index caddf961..acb998a9 100644 --- a/frontend/src/utils/dateTimeUtils.ts +++ b/frontend/src/utils/dateTimeUtils.ts @@ -34,6 +34,21 @@ export function formatDate(dateString: string): string { day: 'numeric', year: 'numeric', }); + } else if ( + /^[A-Za-z]{3}, \d{2} [A-Za-z]{3} \d{4} \d{2}:\d{2}:\d{2} GMT$/.test( + dateString, + ) + ) { + // Format: "Fri, 08 Jul 2025 06:00:00 GMT" + const dateTime = new Date(dateString); + return dateTime.toLocaleDateString('en-US', { + weekday: 'short', + month: 'short', + day: 'numeric', + year: 'numeric', + hour: '2-digit', + minute: '2-digit', + }); } else { return dateString; }