mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Bugfix: improved the way of checking if browser supports Intl.DateTimeFormat (#28086)
This commit is contained in:
parent
c064c16e83
commit
ab33e46789
@ -88,7 +88,7 @@ export function localTimeFormat(
|
|||||||
locale?: string | string[] | null,
|
locale?: string | string[] | null,
|
||||||
fallback?: string
|
fallback?: string
|
||||||
): string {
|
): string {
|
||||||
if (!window.Intl) {
|
if (missingIntlDateTimeFormatSupport()) {
|
||||||
return fallback ?? DEFAULT_SYSTEM_DATE_FORMAT;
|
return fallback ?? DEFAULT_SYSTEM_DATE_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,3 +115,7 @@ export function localTimeFormat(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const systemDateFormats = new SystemDateFormatsState();
|
export const systemDateFormats = new SystemDateFormatsState();
|
||||||
|
|
||||||
|
const missingIntlDateTimeFormatSupport = (): boolean => {
|
||||||
|
return !('DateTimeFormat' in Intl) || !('formatToParts' in Intl.DateTimeFormat.prototype);
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user