MCPcopy
hub / github.com/formatjs/formatjs / shouldPolyfill

Function shouldPolyfill

packages/intl-datetimeformat/should-polyfill.ts:58–71  ·  view source on GitHub ↗
(locale = 'en')

Source from the content-addressed store, hash-verified

56}
57
58export function shouldPolyfill(locale = 'en'): string | undefined {
59 if (
60 typeof Intl === 'undefined' ||
61 !('DateTimeFormat' in Intl) ||
62 !('formatToParts' in Intl.DateTimeFormat.prototype) ||
63 !('formatRange' in Intl.DateTimeFormat.prototype) ||
64 hasChromeLt71Bug() ||
65 hasUnthrownDateTimeStyleBug() ||
66 !supportsDateStyle() ||
67 !supportedLocalesOf(locale)
68 ) {
69 return locale ? match([locale], supportedLocales, 'en') : undefined
70 }
71}

Callers 1

polyfill.tsFile · 0.70

Calls 5

matchFunction · 0.90
hasChromeLt71BugFunction · 0.85
supportsDateStyleFunction · 0.85
supportedLocalesOfFunction · 0.70

Tested by

no test coverage detected