From b78ccb801fda8c4dd7da66ba44c182df6b6340f2 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 27 Sep 2024 13:13:13 +0200 Subject: [PATCH] fix issue --- src/utils/time.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/time.ts b/src/utils/time.ts index bc04f6d..d63c7f2 100644 --- a/src/utils/time.ts +++ b/src/utils/time.ts @@ -9,8 +9,9 @@ import moment from "moment-timezone"; */ export const showDate = (tz: string, locale: Map, date: Date) => { const localeInfo = new Intl.Locale(tz); + const intlTimezone = moment.tz.zonesForCountry(localeInfo.region ?? localeInfo.baseName); const formattedDate = new Intl.DateTimeFormat(tz, { - timeZone: moment.tz.zonesForCountry(localeInfo.region ?? localeInfo.baseName)[0], + timeZone: intlTimezone ? intlTimezone[0] : "Etc/GMT", dateStyle: "short", timeStyle: "medium", })