UNPKG

986 BSource Map (JSON)View Raw
1{"version":3,"file":"get-formatter.js","sourceRoot":"","sources":["../../src/calendar/get-formatter.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,SAA8B;IAazD,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import type { DateTimeFormatter } from './calendar_typing.js';\n\nexport function getFormatter(formatter: Intl.DateTimeFormat): DateTimeFormatter {\n /**\n * NOTE: Due to IE11, a LTR mark (`\\u200e` or `8206` in hex) will be included even when\n * `locale=en-US` is used. This helper function strips that away for consistency's sake as\n * modern browsers do not include that.\n *\n * ```js\n * const now = new Date('2018-01-01');\n * const a = Intl.DateTimeFormat('en-US', { day: 'numeric', timeZone: 'UTC' }).format(now);\n *\n * a.split(''); // On IE11, this returns ['', '1'].\n * ```\n */\n return n => formatter.format(n).replace(/\\u200e/gi, '');\n}\n"]}
\No newline at end of file