fix issue
This commit is contained in:
parent
013dbf4974
commit
b78ccb801f
1 changed files with 2 additions and 1 deletions
|
@ -9,8 +9,9 @@ import moment from "moment-timezone";
|
||||||
*/
|
*/
|
||||||
export const showDate = (tz: string, locale: Map<string, unknown>, date: Date) => {
|
export const showDate = (tz: string, locale: Map<string, unknown>, date: Date) => {
|
||||||
const localeInfo = new Intl.Locale(tz);
|
const localeInfo = new Intl.Locale(tz);
|
||||||
|
const intlTimezone = moment.tz.zonesForCountry(localeInfo.region ?? localeInfo.baseName);
|
||||||
const formattedDate = new Intl.DateTimeFormat(tz, {
|
const formattedDate = new Intl.DateTimeFormat(tz, {
|
||||||
timeZone: moment.tz.zonesForCountry(localeInfo.region ?? localeInfo.baseName)[0],
|
timeZone: intlTimezone ? intlTimezone[0] : "Etc/GMT",
|
||||||
dateStyle: "short",
|
dateStyle: "short",
|
||||||
timeStyle: "medium",
|
timeStyle: "medium",
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue