Commit ab33e467 by Marcus Andersson Committed by GitHub

Bugfix: improved the way of checking if browser supports Intl.DateTimeFormat (#28086)

parent c064c16e
......@@ -88,7 +88,7 @@ export function localTimeFormat(
locale?: string | string[] | null,
fallback?: string
): string {
if (!window.Intl) {
if (missingIntlDateTimeFormatSupport()) {
return fallback ?? DEFAULT_SYSTEM_DATE_FORMAT;
}
......@@ -115,3 +115,7 @@ export function localTimeFormat(
}
export const systemDateFormats = new SystemDateFormatsState();
const missingIntlDateTimeFormatSupport = (): boolean => {
return !('DateTimeFormat' in Intl) || !('formatToParts' in Intl.DateTimeFormat.prototype);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment