(feat:dateTimeUtils) localise weekday format

This commit is contained in:
ManishMadan2882
2025-07-08 02:32:18 +05:30
parent bbce872ac5
commit ca95d7275a

View File

@@ -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;
}