From d449b24eb8e7f961c0c841b214ab3a1c6bc80fc0 Mon Sep 17 00:00:00 2001 From: Borgar Date: Sat, 19 Sep 2026 14:38:45 +0000 Subject: [PATCH 1/4] Groundwork for better locales --- lib/constants.ts | 3 +- lib/delocalize.ts | 201 +++++++++++++++++++++ lib/formatInfo.ts | 16 +- lib/index.ts | 10 +- lib/locale.ts | 23 ++- lib/locales.ts | 309 ++++++++++++++++++++++++++++---- lib/parseFormatSection.ts | 7 +- lib/parseValue/parseNumberNf.ts | 7 +- lib/runPart.ts | 23 ++- lib/tokenHandlers.ts | 169 +++++++++++++++++ lib/tokenize.ts | 94 +++------- lib/types.ts | 7 +- test/delocalize.spec.ts | 287 +++++++++++++++++++++++++++++ test/info.spec.ts | 17 -- 14 files changed, 1023 insertions(+), 150 deletions(-) create mode 100644 lib/delocalize.ts create mode 100644 lib/tokenHandlers.ts create mode 100644 test/delocalize.spec.ts diff --git a/lib/constants.ts b/lib/constants.ts index 23ceb01..3593f4e 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -55,6 +55,7 @@ export const TOKEN_EXP = 'EXP'; export const TOKEN_FILL = 'FILL'; export const TOKEN_PAREN = 'PAREN'; export const TOKEN_CHAR = 'CHAR'; +export const TOKEN_CURRENCY = 'CURRENCY'; export const T_TYPE_INT = 'INT'; export const T_TYPE_NUM = 'NUM'; @@ -170,4 +171,4 @@ export const currencySymbols = [ '₿' ]; -export const reCurrencySymbols = new RegExp('[' + currencySymbols.join('') + ']'); +// export const reCurrencySymbols = new RegExp('[' + currencySymbols.join('') + ']'); diff --git a/lib/delocalize.ts b/lib/delocalize.ts new file mode 100644 index 0000000..d54c548 --- /dev/null +++ b/lib/delocalize.ts @@ -0,0 +1,201 @@ +import { TOKEN_CHAR, TOKEN_COLOR, TOKEN_COMMA, TOKEN_CURRENCY, TOKEN_DATETIME, TOKEN_DURATION, TOKEN_ESCAPED, TOKEN_GENERAL, TOKEN_GROUP, TOKEN_HASH, TOKEN_MODIFIER, TOKEN_POINT, TOKEN_QMARK, TOKEN_SPACE, TOKEN_STRING, TOKEN_ZERO } from './constants.ts'; +import { defaultLocale, getLocale, parseLocale, resolveLocale } from './locale.ts'; +import { getTokenHandlers } from './tokenHandlers.ts'; +import { lexer } from './tokenize.ts'; +import type { Token } from './types.ts'; + +const COLORS: Record = { + black: 'Black', + white: 'White', + red: 'Red', + green: 'Green', + blue: 'Blue', + yellow: 'Yellow', + magenta: 'Magenta', + cyan: 'Cyan' +}; + +function isNumOp (token?: Token): boolean { + const type = token?.type; + return (type === TOKEN_HASH || type === TOKEN_ZERO || type === TOKEN_QMARK); +} + +function eq (a: string, b: string): boolean { + if (a === b) { + return true; + } + // lax group + if (a === '’' && b === "'" || b === '’' && a === "'") { + return true; + } + if (a === ',' && b === '٬' || b === '٬' && a === ',') { + return true; + } + // lax decimal + if (a === '.' && b === '٫' || b === '٫' && a === '.') { + return true; + } + // lax whitespace + if (/^\s$/.test(a) && /^\s$/.test(b)) { + return true; + } + return false; +} + +/** + * Translate a number format pattern from a locale into the default `en-US` variant. + * + * Group and decimal symbols will be flipped as needed, alternative operators letters + * will be changed to the default letters, color names will be translated. + * + * Additionally, non-operator characters as well as escaped characters and quoted strings + * will be collapsed to quoted strings as possible. + * + * @param pattern A format pattern in the ECMA-376 number format. + * @param fromLocale A BCP 47 string tag or Excel [MsoLanguageID](https://docs.microsoft.com/en-us/office/vba/api/office.msolanguageid). + * @returns The default equivalent of the input pattern. + */ +export function delocalize (pattern: string, fromLocale: string | number): string { + const l = parseLocale(resolveLocale(fromLocale) ?? 'en-US'); + const l10n = getLocale(l.lang) ?? defaultLocale; + + const flipNum = l10n?.decimal !== '.'; + const wsGroup = /^\s$/.test(l10n.group); + // Translate tokens + const handlers = getTokenHandlers(l10n); + const tokens = lexer(pattern, handlers); + + // setup + const colorTag = (l10n.color ?? 'Color').toLowerCase(); + const colorNames = l10n.colors ?? COLORS; + const opcodes = l10n.opcodes; + + // pass 1: + const out: Token[] = []; + for (let i = 0; i < tokens.length; i++) { + const t = tokens[i]; + const type = t.type; + if (type === TOKEN_COLOR || type === TOKEN_MODIFIER) { + const v = t.value.toLowerCase(); + const isLC = v === t.value; + if (v.startsWith(colorTag)) { + const o = `[${isLC ? 'color' : 'Color'}${t.value.slice(colorTag.length)}]`; + out.push({ type: TOKEN_COLOR, value: o, raw: o }); + } + else if (v in colorNames) { + const o = `[${isLC ? colorNames[v].toLowerCase() : colorNames[v]}]`; + out.push({ type: TOKEN_COLOR, value: o, raw: o }); + } + else { + out.push(t); + } + } + else if (opcodes && type === TOKEN_DATETIME) { + const lc1 = t.value.charAt(0).toLowerCase(); + if (opcodes.dy && lc1 === opcodes.dy) { + out.push({ type: TOKEN_DATETIME, value: '', raw: 'Y'.repeat(t.value.length) }); + } + else if (opcodes.dm && lc1 === opcodes.dm || opcodes.tm && lc1 === opcodes.tm) { + out.push({ type: TOKEN_DATETIME, value: '', raw: 'M'.repeat(t.value.length) }); + } + else if (opcodes.dd && lc1 === opcodes.dd) { + out.push({ type: TOKEN_DATETIME, value: '', raw: 'D'.repeat(t.value.length) }); + } + else if (opcodes.th && lc1 === opcodes.th) { + out.push({ type: TOKEN_DATETIME, value: '', raw: 'H'.repeat(t.value.length) }); + } + else if (opcodes.ts && lc1 === opcodes.ts) { + out.push({ type: TOKEN_DATETIME, value: '', raw: 'S'.repeat(t.value.length) }); + } + else { + out.push(t); + } + } + else if (opcodes && type === TOKEN_DURATION) { + const lc1 = t.value.charAt(0).toLowerCase(); + if (opcodes.th && lc1 === opcodes.th) { + out.push({ type: TOKEN_DURATION, value: '', raw: '[H]' }); + } + else if (opcodes.tm && lc1 === opcodes.tm) { + out.push({ type: TOKEN_DURATION, value: '', raw: '[M]' }); + } + else if (opcodes.ts && lc1 === opcodes.ts) { + out.push({ type: TOKEN_DURATION, value: '', raw: '[S]' }); + } + else { + out.push(t); + } + } + else if (wsGroup && type === TOKEN_SPACE && isNumOp(tokens[i - 1]) && isNumOp(tokens[i + 1])) { + out.push({ type: TOKEN_GROUP, value: ',', raw: ',' }); + } + else if (flipNum && type === TOKEN_POINT && isNumOp(tokens[i - 1]) && isNumOp(tokens[i + 1])) { + out.push({ type: TOKEN_GROUP, value: ',', raw: ',' }); + } + else if (type === TOKEN_CHAR && eq(t.value, l10n.group)) { + out.push({ type: TOKEN_GROUP, value: ',', raw: ',' }); + } + else if (flipNum && (type === TOKEN_COMMA || type === TOKEN_GROUP)) { + out.push({ type: TOKEN_POINT, value: '.', raw: '.' }); + } + else { + out.push(t); + } + } + + // Emit a "cleaned" string of tokens where chars/strings/escapes have been collapsed + let s = ''; + let inStr = false; + for (const t of out) { + if (t.type === TOKEN_POINT && inStr) { + s += t.raw; + } + else if (t.type === TOKEN_CURRENCY) { + const as_str = /[a-z]/i.test(t.raw); + if (inStr && !as_str) { + s += '"'; + inStr = false; + } + else if (!inStr && as_str) { + s += '"'; + inStr = true; + } + s += t.raw; + } + else if (t.type === TOKEN_ESCAPED && t.value === '"') { + if (inStr) { + s += '"'; + inStr = false; + } + s += t.raw; + } + else if (t.type === TOKEN_ESCAPED || t.type === TOKEN_STRING) { + if (!inStr) { + s += '"'; + inStr = true; + } + s += t.value; + } + else if (t.type === TOKEN_GENERAL) { + s += 'General'; + } + else if (t.type === TOKEN_CHAR) { + if (!inStr && t.value !== ':') { + s += '"'; + inStr = true; + } + s += t.raw; + } + else { + if (inStr) { + s += '"'; + inStr = false; + } + s += t.raw; + } + } + if (inStr) { + s += '"'; + } + return s; +} diff --git a/lib/formatInfo.ts b/lib/formatInfo.ts index a581d6b..3e3d755 100644 --- a/lib/formatInfo.ts +++ b/lib/formatInfo.ts @@ -1,4 +1,4 @@ -import { u_YEAR, u_MONTH, u_DAY, u_HOUR, u_MIN, u_SEC, reCurrencySymbols, TOKEN_STRING, T_TYPE_YEAR, T_TYPE_YEAR_S, T_TYPE_B_YEAR, T_TYPE_B_YEAR_S, T_TYPE_MON, T_TYPE_MNAME, T_TYPE_MNAME_S, T_TYPE_MNAME_1, T_TYPE_WEEKDAY, T_TYPE_WEEKDAY_S, T_TYPE_DAY, T_TYPE_HOUR, T_TYPE_MIN, T_TYPE_SEC, TOKEN_AMPM } from './constants.ts'; +import { u_YEAR, u_MONTH, u_DAY, u_HOUR, u_MIN, u_SEC, TOKEN_STRING, T_TYPE_YEAR, T_TYPE_YEAR_S, T_TYPE_B_YEAR, T_TYPE_B_YEAR_S, T_TYPE_MON, T_TYPE_MNAME, T_TYPE_MNAME_S, T_TYPE_MNAME_1, T_TYPE_WEEKDAY, T_TYPE_WEEKDAY_S, T_TYPE_DAY, T_TYPE_HOUR, T_TYPE_MIN, T_TYPE_SEC, TOKEN_AMPM, TOKEN_CURRENCY } from './constants.ts'; import type { FormatDateInfo, FormatInfo, Partition } from './types.ts'; export function isPercent (partitions: Partition[]): boolean { @@ -56,7 +56,7 @@ const dateCodes: [ string, number ][] = [ [ 'hm', 9 ] ]; -export function info (partitions: Partition[], currencyId?: string): FormatInfo { +export function info (partitions: Partition[]): FormatInfo { const [ partPos, partNeg ] = partitions; const frac_max = partPos.frac_max; const output: FormatInfo = { @@ -76,12 +76,12 @@ export function info (partitions: Partition[], currencyId?: string): FormatInfo // currency identifier may be passed in, but otherwise we report // if we find any known glyph in the tokens - const isCurrency = (!output.isDate && !output.isText && !partPos.error) && partPos.tokens.some(tok => ( - tok.type === TOKEN_STRING && - (currencyId - ? tok.value === currencyId - : reCurrencySymbols.test(tok.value)) - )); + const isCurrency = ( + !output.isDate && + !output.isText && + !partPos.error && + partPos.tokens.some(tok => tok.type === TOKEN_CURRENCY) + ); let codeType = 'G'; let codeNum = (frac_max >= 0) ? Math.min(15, frac_max) : 0; diff --git a/lib/index.ts b/lib/index.ts index 7692e3b..74e89b3 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -18,6 +18,7 @@ export { import { defaultOptions, type FormatOptions } from './options.ts'; +export { delocalize } from './delocalize.ts'; export { round } from './round.ts'; export { dec2frac } from './dec2frac.ts'; export type { FormatOptions } from './options.ts'; @@ -235,17 +236,12 @@ export function isValidFormat (pattern: string): boolean { * format pattern is invalid and would cause the formatter to throw. * * @param pattern A format pattern in the ECMA-376 number format. - * @param [options={}] Options for the method - * @param [options.currency] - * Limit the patterns identified as currency to those that use the give string. - * If nothing is provided, patterns will be tagged as currency if one of the - * following currency symbols is used: `¤$£¥֏؋৳฿៛₡₦₩₪₫€₭₮₱₲₴₸₹₺₼₽₾₿` * @returns An object of format properties. */ -export function getFormatInfo (pattern: string, options: { currency?: string; } = {}): FormatInfo { +export function getFormatInfo (pattern: string): FormatInfo { const data = prepareFormatterData(pattern, false); if (!data.info) { - data.info = info(data.partitions, options?.currency); + data.info = info(data.partitions); } return data.info; } diff --git a/lib/locale.ts b/lib/locale.ts index 8de1e28..5e12ce8 100644 --- a/lib/locale.ts +++ b/lib/locale.ts @@ -111,10 +111,12 @@ export type LocaleData = { */ general?: string, /** - * The 8 color keywords are written in the language. - * @default ["Black", "White", "Red", "Green", "Blue", "Yellow", "Magenta", "Cyan"] + * A map for the color keywords in the language, into US English. + * The keys should be the lower-case localized versions (`bianco`) and the values + * should be title-cased English equivalents (`Black`). + * @default {black:"Black", white:"White", red:"Red", green:"Green", blue:"Blue", yellow:"Yellow", magenta:"Magenta", cyan:"Cyan"} */ - colors?: string[], + colors?: Record, /** * Operator symbol map.This is a record of characters, one for each operator. The value should * be single character lower case strings. Keys are as follows: @@ -185,7 +187,16 @@ const baseLocaleData: LocaleData = { general: 'General', currency: '$', color: 'Color', - colors: [ 'Black', 'White', 'Red', 'Green', 'Blue', 'Yellow', 'Magenta', 'Cyan' ], + colors: { + black: 'Black', + white: 'White', + red: 'Red', + green: 'Green', + blue: 'Blue', + yellow: 'Yellow', + magenta: 'Magenta', + cyan: 'Cyan' + }, // dateOrder: 0, preferMDY: false // lcid: -1, @@ -255,6 +266,7 @@ export function createLocale (data: Partial): LocaleData { return Object.assign({}, baseLocaleData, data); } +// XXX: FIXME --- needs more docs /** * Register locale data for a language to use when formatting. * @@ -307,9 +319,12 @@ export function addLocale (localeSettings: Partial, l4e: string | Lo if (c.language !== c.lang && !locales[c.language]) { locales[c.language] = createLocale(localeSettings); } + s.add(locales[c.lang].decimal); return locales[c.lang]; } +const s = new Set(); + /** * Get a list of locales that are registered with the formatter. * @returns A list of locale tags diff --git a/lib/locales.ts b/lib/locales.ts index 3b54f44..25c3db7 100644 --- a/lib/locales.ts +++ b/lib/locales.ts @@ -55,7 +55,16 @@ const xm = (o: Partial & Pick, ml: numb export function initLocales () { const _zhM4 = _M('一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月'); - const _zhCl = [ '黑色', '白色', '紅色', '綠色', '藍色', '黃色', '洋紅', '青色' ]; + const _zhCl = { + 黑色: 'Black', + 白色: 'White', + 紅色: 'Red', + 綠色: 'Green', + 藍色: 'Blue', + 黃色: 'Yellow', + 洋紅: 'Magenta', + 青色: 'Cyan' + }; addLocale({ group: ',', ampm: _B('上午;下午'), @@ -64,7 +73,16 @@ export function initLocales () { dddd: _W('~日;~一;~二;~三;~四;~五;~六', '星期'), ddd: _W('周日;周一;周二;周三;周四;周五;周六'), color: '颜色', - colors: [ '黑色', '白色', '红色', '绿色', '蓝色', '黄色', '洋红', '蓝绿色' ], + colors: { + 黑色: 'Black', + 白色: 'White', + 红色: 'Red', + 绿色: 'Green', + 蓝色: 'Blue', + 黄色: 'Yellow', + 洋红: 'Magenta', + 蓝绿色: 'Cyan' + }, general: 'G/通用格式', currency: '¥' }, 'zh-CN'); @@ -103,7 +121,16 @@ export function initLocales () { general: 'G/標準', currency: '¥', color: '色', - colors: [ '黒', '白', '赤', '緑', '青', '黄', '紫', '水' ] + colors: { + 黒: 'Black', + 白: 'White', + 赤: 'Red', + 緑: 'Green', + 青: 'Blue', + 黄: 'Yellow', + 紫: 'Magenta', + 水: 'Cyan' + } }, 'ja'); addLocale({ @@ -114,7 +141,16 @@ export function initLocales () { dddd: _W('일요일;월요일;화요일;수요일;목요일;금요일;토요일'), ddd: _W('일;월;화;수;목;금;토'), color: '색', - colors: [ '검정', '흰색', '빨강', '녹색', '파랑', '노랑', '자홍', '녹청' ], + colors: { + 검정: 'Black', + 흰색: 'White', + 빨강: 'Red', + 녹색: 'Green', + 파랑: 'Blue', + 노랑: 'Yellow', + 자홍: 'Magenta', + 녹청: 'Cyan' + }, general: 'G/표준', currency: '₩' }, 'ko'); @@ -127,7 +163,16 @@ export function initLocales () { dddd: _W('อาทิตย์;จันทร์;อังคาร;พุธ;พฤหัสบดี;ศุกร์;เสาร์'), ddd: _W('อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.'), color: 'สี', - colors: [ 'ดำ', 'ขาว', 'แดง', 'เขียว', 'น้ำเงิน', 'เหลือง', 'ม่วงมาเจนต้า', 'ฟ้า' ], + colors: { + ดำ: 'Black', + ขาว: 'White', + แดง: 'Red', + เขียว: 'Green', + น้ำเงิน: 'Blue', + เหลือง: 'Yellow', + ม่วงมาเจนต้า: 'Magenta', + ฟ้า: 'Cyan' + }, currency: '฿' }, 'th'); @@ -139,7 +184,16 @@ export function initLocales () { dddd: _W('neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota'), bool: _B('PRAVDA;NEPRAVDA'), color: 'Barva', - colors: [ 'Černá', 'Bílá', 'Červená', 'Zelená', 'Modrá', 'Žlutá', 'Purpurová', 'Azurová' ], + colors: { + černá: 'Black', + bílá: 'White', + červená: 'Red', + zelená: 'Green', + modrá: 'Blue', + žlutá: 'Yellow', + purpurová: 'Magenta', + azurová: 'Cyan' + }, general: 'Všeobecný', opcodes: { dy: 'r' }, currency: 'Kč' @@ -152,7 +206,16 @@ export function initLocales () { dddd: _W('søn~;man~;tirs~;ons~;tors~;fre~;lør~', 'dag'), bool: _B('SAND;FALSK'), color: 'Farve', - colors: [ 'Sort', 'Hvid', 'Rød', 'Lysegrøn', 'Blå', 'Gul', 'Lyslilla', 'Akvamarin' ], + colors: { + sort: 'Black', + hvid: 'White', + rød: 'Red', + lysegrøn: 'Green', + blå: 'Blue', + gul: 'Yellow', + lyslilla: 'Magenta', + akvamarin: 'Cyan' + }, general: 'Standard', opcodes: { dy: 'å', th: 't' }, currency: 'kr.' @@ -166,7 +229,17 @@ export function initLocales () { dddd: _W('zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag'), bool: _B('WAAR;ONWAAR'), color: 'Kleur', - colors: [ 'Zwart', 'Wit', 'Rood', 'Groen', 'Blauw', 'Geel', 'Magenta', 'Cyaan' ], + colors: { + zwart: 'Black', + wit: 'White', + rood: 'Red', // mac + root: 'Red', // win? + groen: 'Green', + blauw: 'Blue', + geel: 'Yellow', + magenta: 'Magenta', + cyaan: 'Cyan' + }, general: 'Standaard', opcodes: { dy: 'j', th: 'u' }, currency: '€' @@ -175,8 +248,8 @@ export function initLocales () { addLocale({ group: ',', preferMDY: true }, 'en'); addLocale({ group: ',', preferMDY: true }, 'en-US'); addLocale({ group: ',' }, 'en-CA'); - addLocale({ group: ',', color: 'Colour', ampm: [ 'am', 'pm' ] }, 'en-AU'); - addLocale({ group: ',', color: 'Colour', ampm: [ 'am', 'pm' ], currency: '£' }, 'en-GB'); + addLocale({ group: ',', color: 'Colour', ampm: [ 'AM', 'PM' ] }, 'en-AU'); + addLocale({ group: ',', color: 'Colour', ampm: [ 'AM', 'PM' ], currency: '£' }, 'en-GB'); addLocale({ group: ',', mmm: _M('Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec'), @@ -194,7 +267,16 @@ export function initLocales () { dddd: _W('sunnun~;maanan~;tiis~;keskiviikko;tors~;perjan~;lauan~', 'tai'), bool: _B('TOSI;EPÄTOSI'), color: 'Väri', - colors: [ 'Musta', 'Valkoinen', 'Punainen', 'Vihreä', 'Sininen', 'Keltainen', 'Magenta', 'Syaani' ], + colors: { + musta: 'Black', + valkoinen: 'White', + punainen: 'Red', + vihreä: 'Green', + sininen: 'Blue', + keltainen: 'Yellow', + magenta: 'Magenta', + syaani: 'Cyan' + }, general: 'Yleinen', currency: '€', opcodes: { dy: 'v', dm: 'k', dd: 'p', th: 't' } @@ -209,7 +291,16 @@ export function initLocales () { ddd: [ 'dim', 'lun', 'mar', 'mer', 'jeu', 'ven', 'sam' ], bool: _B('VRAI;FAUX'), color: 'Couleur', - colors: [ 'Noir', 'Blanc', 'Rouge', 'Vert', 'Bleu', 'Jaune', 'Magenta', 'Cyan' ], + colors: { + noir: 'Black', + blanc: 'White', + rouge: 'Red', + vert: 'Green', + bleu: 'Blue', + jaune: 'Yellow', + magenta: 'Magenta', + cyan: 'Cyan' + }, opcodes: { dy: 'a', dd: 'j' }, general: 'Standard' }, -1, -13); @@ -223,8 +314,17 @@ export function initLocales () { dddd: _W('Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~', 'tag'), bool: _B('WAHR;FALSCH'), color: 'Farbe', - colors: [ 'Schwarz', 'Weiß', 'Rot', 'Grün', 'Blau', 'Gelb', 'Magenta', 'Zyan' ], - opcodes: { dy: 'J', dm: 'M', dd: 'T' }, + colors: { + schwarz: 'Black', + weiß: 'White', + rot: 'Red', + grün: 'Green', + blau: 'Blue', + gelb: 'Yellow', + magenta: 'Magenta', + zyan: 'Cyan' + }, + opcodes: { dy: 'j', dd: 't' }, general: 'Standard' }, -1, 2); addLocale({ group: '.', decimal: ',', ..._de, currency: '€' }, 'de'); @@ -238,7 +338,16 @@ export function initLocales () { mmm: _M('Ιαν;Φεβ;Μαρ;Απρ;Μαϊ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ'), dddd: _W('Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο'), ddd: [ 'Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ' ], - colors: [ 'Μαύρο', 'Λευκό', 'Κόκκινο', 'Πράσινο', 'Μπλε', 'Κίτρινο', 'Ματζέντα', 'Γαλάζιο' ], + colors: { + μαύρο: 'Black', + λευκό: 'White', + κόκκινο: 'Red', + πράσινο: 'Green', + μπλε: 'Blue', + κίτρινο: 'Yellow', + ματζέντα: 'Magenta', + γαλάζιο: 'Cyan' + }, general: 'Γενικός τύπος', color: 'Χρώμα', opcodes: { dy: 'ε', dm: 'μ', dd: 'η', th: 'ω', tm: 'λ', ts: 'δ' }, @@ -256,7 +365,16 @@ export function initLocales () { currency: 'Ft', general: 'Normál', opcodes: { dy: 'é', dm: 'h', dd: 'n', th: 'ó', tm: 'p', ts: 'm' }, - colors: [ 'Fekete', 'Fehér', 'Piros', 'Zöld', 'Kék', 'Sárga', 'Bíbor', 'Ciánkék' ], + colors: { + fekete: 'Black', + fehér: 'White', + piros: 'Red', + zöld: 'Green', + kék: 'Blue', + sárga: 'Yellow', + bíbor: 'Magenta', + ciánkék: 'Cyan' + }, color: 'Szín' }, 'hu'); @@ -277,7 +395,16 @@ export function initLocales () { dddd: _W('Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu'), ddd: _W('Mgg;Sen;Sel;Rab;Kam;Jum;Sab'), color: 'Warna', - colors: [ 'Hitam', 'Putih', 'Merah', 'Hijau', 'Biru', 'Kuning', 'Magenta', 'Sian' ], + colors: { + hitam: 'Black', + putih: 'White', + merah: 'Red', + hijau: 'Green', + biru: 'Blue', + kuning: 'Yellow', + magenta: 'Magenta', + sian: 'Cyan' + }, currency: 'Rp' }, 3, 3), 'id'); @@ -287,13 +414,23 @@ export function initLocales () { bool: _B('VERO;FALSO'), general: 'Standard', color: 'Colore', - colors: [ 'Nero', 'Bianco', 'Rosso', 'Verde', 'Blu', 'Giallo', 'Fucsia', 'Celeste' ], + colors: { + nero: 'Black', + bianco: 'White', + rosso: 'Red', + verde: 'Green', + blu: 'Blue', + giallo: 'Yellow', + fucsia: 'Magenta', + celeste: 'Cyan', // mac + ciano: 'Cyan' // win + }, opcodes: { dy: 'a', dd: 'g' } }, 3, 3); addLocale({ group: '.', decimal: ',', ..._it, currency: '€' }, 'it'); addLocale({ group: '’', decimal: '.', ..._it, currency: 'CHF' }, 'it-CH'); - const _no = { + const _no: LocaleData = { decimal: ',', ampm: _B('a.m.;p.m.'), mmmm: _M('januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember'), @@ -301,7 +438,16 @@ export function initLocales () { dddd: _W('søn~;man~;tirs~;ons~;tors~;fre~;lør~', 'dag'), bool: _B('SANN;USANN'), color: 'Farge', - colors: [ 'Svart', 'Hvit', 'Rød', 'Grønn', 'Blå', 'Gul', 'Magenta', 'Cyan' ], + colors: { + svart: 'Black', + hvit: 'White', + rød: 'Red', + grønn: 'Green', + blå: 'Blue', + gul: 'Yellow', + magenta: 'Magenta', + cyan: 'Cyan' + }, general: 'Standard', opcodes: { dy: 'å', th: 't' }, currency: 'kr' @@ -316,13 +462,22 @@ export function initLocales () { ddd: _W('niedz;pon;wt;śr;czw;pt;sob'), bool: _B('PRAWDA;FAŁSZ'), color: 'Kolor', - colors: [ 'Czarny', 'Biały', 'Czerwony', 'Zielony', 'Niebieski', 'Żółty', 'Amarantowy', 'Błękitny' ], + colors: { + czarny: 'Black', + biały: 'White', + czerwony: 'Red', + zielony: 'Green', + niebieski: 'Blue', + żółty: 'Yellow', + amarantowy: 'Magenta', + błękitny: 'Cyan' + }, general: 'Standardowy', opcodes: { dy: 'r', th: 'g' }, currency: 'zł' }, 3, -1), 'pl'); - const _pt = { + const _pt: LocaleData = { decimal: ',', mmmm: _M('janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro'), dddd: _W('domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado'), @@ -334,14 +489,33 @@ export function initLocales () { ...xm(_pt, 3, 3), group: '\u202f', general: 'Estandar', - colors: [ 'Preto', 'Branco', 'Vermelho', 'Verde', 'Azul', 'Amarelo', 'Magenta', 'Turquesa' ], + colors: { + preto: 'Black', + branco: 'White', + vermelho: 'Red', + verde: 'Green', + azul: 'Blue', + amarelo: 'Yellow', + magenta: 'Magenta', + turquesa: 'Cyan', // mac + ciano: 'Cyan' // pc + }, currency: '€' }, 'pt'); addLocale({ ...xm(_pt, 3, 3), group: '.', general: 'Geral', - colors: [ 'Preto', 'Branco', 'Vermelho', 'Verde', 'Azul', 'Amarelo', 'Magenta', 'Ciano' ], + colors: { + preto: 'Black', + branco: 'White', + vermelho: 'Red', + verde: 'Green', + azul: 'Blue', + amarelo: 'Yellow', + magenta: 'Magenta', + ciano: 'Cyan' + }, currency: 'R$' }, 'pt-BR'); @@ -356,9 +530,19 @@ export function initLocales () { mmm6: _M('рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам.'), bool: _B('ИСТИНА;ЛОЖЬ'), general: 'Основной', - opcodes: { dy: 'Г', dm: 'М', dd: 'Д', th: 'ч', tm: 'м', ts: 'с' }, + opcodes: { dy: 'г', dm: 'м', dd: 'д', th: 'ч', tm: 'м', ts: 'с' }, color: 'Цвет', - colors: [ 'Черный', 'Белый', 'Красный', 'Зеленый', 'Синий', 'Желтый', 'Фиолетовый', 'Голубой' ], + colors: { + черный: 'Black', + белый: 'White', + красный: 'Red', + зеленый: 'Green', + синий: 'Blue', + желтый: 'Yellow', + фиолетовый: 'Magenta', // mac + пурпурный: 'Magenta', // win + голубой: 'Cyan' + }, currency: '₽' }, 'ru'); @@ -368,11 +552,20 @@ export function initLocales () { mmm: _M('1;2;3;4;5;6;7;8;9;10;11;12'), dddd: _W('nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota'), color: 'Farba', - colors: [ 'Čierna', 'Biela', 'Červená', 'Zelená', 'Modrá', 'Žltá', 'Purpurová', 'Azúrová' ], + colors: { + čierna: 'Black', + biela: 'White', + červená: 'Red', + zelená: 'Green', + modrá: 'Blue', + žltá: 'Yellow', + purpurová: 'Magenta', + azúrová: 'Cyan' + }, currency: '€' }, 3, 2), 'sk'); - const _es = { + const _es: LocaleData = { group: '.', decimal: ',', ampm: _B('a.\u00A0m.;p.\u00A0m.'), @@ -381,7 +574,17 @@ export function initLocales () { dddd: _W('domingo;lunes;martes;miércoles;jueves;viernes;sábado'), ddd: _W('dom;lun;mar;mié;jue;vie;sáb'), bool: _B('VERDADERO;FALSO'), - colors: [ 'Negro', 'Blanco', 'Rojo', 'Verde', 'Azul', 'Amarillo', 'Magenta', 'Cian' ] + colors: { + negro: 'Black', + blanco: 'White', + rojo: 'Red', + verde: 'Green', + azul: 'Blue', + amarillo: 'Yellow', + magenta: 'Magenta', + cian: 'Cyan', // mac + ciano: 'Cyan' // pc + } }; const _esM3 = _M('ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic'); const _esM3s = _M('ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic'); @@ -417,11 +620,20 @@ export function initLocales () { ampm: _B('fm;em'), mmmm: _M('januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december'), dddd: _W('sön~;mån~;tis~;ons~;tors~;fre~;lör~', 'dag'), - opcodes: { dy: 'Å', dm: 'M', dd: 'D', th: 't' }, + opcodes: { dy: 'å', th: 't' }, bool: [ 'SANT', 'FALSKT' ], general: 'Standard', color: 'Färg', - colors: [ 'Svart', 'Vit', 'Röd', 'Grön', 'Blå', 'Gul', 'Magenta', 'Cyanblå' ], + colors: { + svart: 'Black', + vit: 'White', + röd: 'Red', + grön: 'Green', + blå: 'Blue', + gul: 'Yellow', + magenta: 'Magenta', + cyanblå: 'Cyan' + }, currency: 'kr' }, 3, 3), 'sv'); @@ -435,7 +647,16 @@ export function initLocales () { ddd: _W('Paz;Pzt;Sal;Çar;Per;Cum;Cmt'), bool: _B('DOĞRU;YANLIŞ'), color: 'Renk', - colors: [ 'Siyah', 'Beyaz', 'Kırmızı', 'Yeşil', 'Mavi', 'Sarı', 'Pembe', 'Camgöbeği' ], + colors: { + siyah: 'Black', + beyaz: 'White', + kırmızı: 'Red', + yeşil: 'Green', + mavi: 'Blue', + sarı: 'Yellow', + pembe: 'Magenta', + camgöbeği: 'Cyan' + }, opcodes: { dm: 'a', dd: 'g', th: 's', tm: 'd', ts: 'n' }, general: 'Genel', currency: '₺' @@ -524,7 +745,16 @@ export function initLocales () { mmmm6: _M('רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן'), mmm6: _M('רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן'), color: 'צבע', - colors: [ 'שחור', 'לבן', 'אדום', 'ירוק', 'כחול', 'צהוב', 'אדום ארגמן', 'תכלת' ], + colors: { + 'שחור': 'Black', + 'לבן': 'White', + 'אדום': 'Red', + 'ירוק': 'Green', + 'כחול': 'Blue', + 'צהוב': 'Yellow', + 'אדום ארגמן': 'Magenta', + 'תכלת': 'Cyan' + }, currency: '₪' }, 'he'); @@ -560,7 +790,7 @@ export function initLocales () { mmm: _M('қаң;ақп;нау;сәу;мам;мау;шіл;там;қыр;қаз;қар;жел'), dddd: _W('жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі'), ddd: _W('жек;дүй;сей;сәр;бей;жұм;сен'), - opcodes: { dy: 'Г', dm: 'М', dd: 'Д', th: 'ч', tm: 'м', ts: 'с' }, + opcodes: { dy: 'г', dm: 'м', dd: 'д', th: 'ч', tm: 'м', ts: 'с' }, currency: '₸', general: 'Основной' }, -1, -1), 'kk'); @@ -723,7 +953,16 @@ export function initLocales () { dddd: _W('الأحد;الإثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت'), mmmm6: _M('رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان'), color: 'اللون', - colors: [ 'أسود', 'أبيض', 'أحمر', 'أخضر', 'أزرق', 'أصفر', 'ماجنتا', 'سماوي' ], + colors: { + أسود: 'Black', + أبيض: 'White', + أحمر: 'Red', + أخضر: 'Green', + أزرق: 'Blue', + أصفر: 'Yellow', + ماجنتا: 'Magenta', + سماوي: 'Cyan' + }, currency: '⃁' }, 0, 0), 'ar'); diff --git a/lib/parseFormatSection.ts b/lib/parseFormatSection.ts index 0ac4d80..739187e 100644 --- a/lib/parseFormatSection.ts +++ b/lib/parseFormatSection.ts @@ -10,7 +10,8 @@ import { T_TYPE_INT, T_TYPE_NUM, T_TYPE_DEN, T_TYPE_DIV, T_TYPE_FRAC, T_TYPE_MAN, T_TYPE_SUBSEC, T_TYPE_YEAR_S, T_TYPE_YEAR, T_TYPE_B_YEAR_S, T_TYPE_B_YEAR, T_TYPE_DAY, T_TYPE_WEEKDAY_S, T_TYPE_WEEKDAY, T_TYPE_HOUR, T_TYPE_MNAME_S, T_TYPE_MNAME_1, T_TYPE_MNAME, T_TYPE_MIN, T_TYPE_MON, T_TYPE_HOUR_E, T_TYPE_MIN_E, - T_TYPE_SEC_E, T_TYPE_SEC + T_TYPE_SEC_E, T_TYPE_SEC, + TOKEN_CURRENCY } from './constants.ts'; import type { DateRenderToken, Token, RenderToken, SectionType } from './types.ts'; import { createPartition } from './createPartition.ts'; @@ -407,6 +408,10 @@ export function parseFormatSection (inputTokens: Token[]) { add({ type, value: token.value }, outputTokens); } + else if (type === TOKEN_CURRENCY) { + add({ type, value: token.value }, outputTokens); + } + else if (type === TOKEN_DBNUM) { // UNSUPPORTED: // - DBNum1 = NatNum4 diff --git a/lib/parseValue/parseNumberNf.ts b/lib/parseValue/parseNumberNf.ts index 4ebcb11..c00ab60 100644 --- a/lib/parseValue/parseNumberNf.ts +++ b/lib/parseValue/parseNumberNf.ts @@ -1,5 +1,6 @@ -import { currencySymbols, reCurrencySymbols } from '../constants.ts'; +import { currencySymbols } from '../constants.ts'; import type { LocaleData } from '../locale.ts'; +import { reCurrencySymbol } from '../tokenHandlers.ts'; import type { ParseDataNum } from './types.ts'; const PT = '.'; @@ -47,7 +48,7 @@ export function parseNumberNf (value: string, l10n: LocaleData): ParseDataNum | minus = true; sign = -1; } - else if (reCurrencySymbols.test(char)) { + else if (reCurrencySymbol.test(char)) { if (currency) { return undefined; } @@ -123,7 +124,7 @@ export function parseNumberNf (value: string, l10n: LocaleData): ParseDataNum | while (suffixChars.includes(value[i])) { const char = value[i]; // only 1 occurance of these is allowed - if (reCurrencySymbols.test(char)) { + if (reCurrencySymbol.test(char)) { if (currency) { return undefined; } diff --git a/lib/runPart.ts b/lib/runPart.ts index 52283d0..bf72325 100644 --- a/lib/runPart.ts +++ b/lib/runPart.ts @@ -44,7 +44,8 @@ import { T_TYPE_MIN_E, T_TYPE_SEC_E, T_TYPE_B_YEAR, - T_TYPE_B_YEAR_S + T_TYPE_B_YEAR_S, + TOKEN_CURRENCY } from './constants.ts'; import { pad } from './pad.ts'; import { getExponent, getSignificand } from './numberProps.ts'; @@ -375,10 +376,16 @@ export function runPart (value: number | string | bigint, part: Partition, opts: // number isn't fragmented if (part.int_pattern.length === 1) { const pt = part.int_p; - const l = Math.max(part.int_min, integer.length); + const special_case_zero = part.exponential && !value; + const l = special_case_zero + ? Math.max(part.int_min, part.int_max, integer.length) + : Math.max(part.int_min, integer.length); let digits = ''; for (let i = l; i > 0; i--) { - const d = integer.charAt(integer.length - i); + let d = integer.charAt(integer.length - i); + if (special_case_zero && !d) { + d = '0'; + } const p = d ? '' : pt.charAt(pt.length - i) || pt[0]; let sep = ''; if (part.grouping) { @@ -389,8 +396,14 @@ export function runPart (value: number | string | bigint, part: Partition, opts: : pad('?', opts.nbsp); } } + // if (special_case_zero) { + // console.log([ d ]); + // } digits += (d || pad(p, opts.nbsp)) + sep; } + // if (special_case_zero) { + // digits += `{${l}}`; + // } ret.push(digits); } else { @@ -484,6 +497,10 @@ export function runPart (value: number | string | bigint, part: Partition, opts: else if (tok.type === T_TYPE_WEEKDAY_S) { ret.push(l10n.ddd[weekday]); } + else if (tok.type === TOKEN_CURRENCY) { + // XXX: add an option to emit locale currency over the parsed one? + ret.push(tok.value); + } else if (tokenType === T_TYPE_WEEKDAY) { ret.push(l10n.dddd[weekday]); } diff --git a/lib/tokenHandlers.ts b/lib/tokenHandlers.ts new file mode 100644 index 0000000..b31876c --- /dev/null +++ b/lib/tokenHandlers.ts @@ -0,0 +1,169 @@ +import { + TOKEN_GENERAL, TOKEN_HASH, TOKEN_ZERO, TOKEN_QMARK, TOKEN_SLASH, TOKEN_GROUP, TOKEN_SCALE, + TOKEN_COMMA, TOKEN_BREAK, TOKEN_TEXT, TOKEN_PLUS, TOKEN_MINUS, TOKEN_POINT, TOKEN_SPACE, + TOKEN_PERCENT, TOKEN_DIGIT, TOKEN_CALENDAR, TOKEN_ERROR, TOKEN_DATETIME, TOKEN_DURATION, + TOKEN_CONDITION, TOKEN_DBNUM, TOKEN_NATNUM, TOKEN_LOCALE, TOKEN_COLOR, TOKEN_MODIFIER, + TOKEN_AMPM, TOKEN_ESCAPED, TOKEN_STRING, TOKEN_SKIP, TOKEN_EXP, TOKEN_FILL, TOKEN_PAREN, + TOKEN_CHAR, + TOKEN_CURRENCY, + currencySymbols +} from './constants.ts'; +import type { LocaleData } from './locale.ts'; +import type { Token, TokenType } from './types.ts'; + +const reEsc = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +export const reCurrencySymbol = new RegExp('^[' + reEsc(currencySymbols.join('')) + ']'); + +export const TOKEN_HANDLERS: [ TokenType, RegExp, number ][] = [ + [ TOKEN_GENERAL, /^General/i, 0 ], + [ TOKEN_HASH, /^#/, 0 ], + [ TOKEN_ZERO, /^0/, 0 ], + [ TOKEN_QMARK, /^\?/, 0 ], + [ TOKEN_SLASH, /^\//, 0 ], + // Commas are dealt with as a special case in the tokenizer but will end up + // as one of these: + // [ TOKEN_GROUP, /^(,),*/, 1 ], + // [ TOKEN_SCALE, /^(,),*/, 1 ], + // [ TOKEN_COMMA, /^(,),*/, 1 ], + [ TOKEN_BREAK, /^;/, 0 ], + [ TOKEN_TEXT, /^@/, 0 ], + [ TOKEN_PLUS, /^\+/, 0 ], + [ TOKEN_MINUS, /^-/, 0 ], + [ TOKEN_POINT, /^\./, 0 ], + [ TOKEN_SPACE, /^ /, 0 ], + [ TOKEN_PERCENT, /^%/, 0 ], + [ TOKEN_CURRENCY, reCurrencySymbol, 0 ], + [ TOKEN_DIGIT, /^[1-9]/, 0 ], + [ TOKEN_CALENDAR, /^(?:B[12])/i, 0 ], + [ TOKEN_ERROR, /^B$/, 0 ], // pattern must not end in a "B" + [ TOKEN_DATETIME, /^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/, 0 ], + [ TOKEN_DURATION, /^(?:\[(h+|m+|s+)\])/i, 1 ], + [ TOKEN_CONDITION, /^\[((?:<[=>]?|>=?|=)\s*(?:-?[.\d]+))\]/, 1 ], + [ TOKEN_DBNUM, /^\[(DBNum[0-4]?\d)\]/i, 1 ], + [ TOKEN_NATNUM, /^\[(NatNum[0-4]?\d)\]/i, 1 ], + [ TOKEN_LOCALE, /^\[\$([^\]]+)\]/, 1 ], + [ TOKEN_COLOR, /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i, 1 ], + // conditionally allow these open ended directions? + [ TOKEN_MODIFIER, /^\[([^\]]+)\]/, 1 ], + [ TOKEN_AMPM, /^(?:AM\/PM|am\/pm|A\/P)/, 0 ], + [ TOKEN_ESCAPED, /^\\(.)/, 1 ], + [ TOKEN_STRING, /^"([^"]*?)"/, 1 ], + [ TOKEN_SKIP, /^_(\\.|.)/, 1 ], + // Google Sheets and Excel diverge on "e": Excel only accepts E. + [ TOKEN_EXP, /^[Ee]([+-])/, 1 ], + [ TOKEN_FILL, /^\*(\\.|.)/, 1 ], + [ TOKEN_PAREN, /^[()]/, 0 ], + [ TOKEN_ERROR, /^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/, 0 ], + [ TOKEN_CHAR, /^./, 0 ] +]; + +export function getTokenHandlers (l10n: LocaleData): [ TokenType, RegExp, number ][] { + // match General + const reGeneral = !(l10n.general === 'General' || !l10n.general) + ? new RegExp(`^(?:General|${reEsc(l10n.general)})`, 'i') + : null; + + // colors + const reColors = l10n.colors + ? new RegExp(`^\\[(${Object.keys(l10n.colors).map(reEsc).join('|')})\\]`, 'i') + : null; + + const reColor = l10n.color + ? new RegExp(`^\\[(${reEsc(l10n.color)}\\s*\\d+)\\]`, 'i') + : null; + + // + let reDatetime; + let reDuration; + if (l10n.opcodes) { + // console.log(l10n.opcodes); + const dy = l10n.opcodes.dy ?? 'y'; + const dm = l10n.opcodes.dm ?? 'm'; + const dd = l10n.opcodes.dd ?? 'd'; + const th = l10n.opcodes.th ?? 'h'; + const tm = l10n.opcodes.tm ?? 'm'; + const ts = l10n.opcodes.ts ?? 's'; + // AAA + const ddd = [ + dy + dy.toUpperCase(), + dm + dm.toUpperCase(), + dd + dd.toUpperCase(), + th + th.toUpperCase(), + tm + tm.toUpperCase(), + ts + ts.toUpperCase(), + 'bB', + 'gG' + ]; + // console.log(ddd); + // [aA]{3,} --- need to mine this 😭 + reDatetime = new RegExp(`^(?:[${ddd.join(']+|[')}]+|e+)`); + reDuration = new RegExp(`^(?:\\[(${th}+|${tm}+|${ts}+)\\]+)`, 'i'); + } + else { + reDatetime = /^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/; + reDuration = /^(?:\[(h+|m+|s+)\])/i; + } + + const reCurrency = l10n.currency.length > 1 || !currencySymbols.includes(l10n.currency) + ? new RegExp(`^(?:${reEsc(l10n.currency)})`) + : null; + + const handlers: [ TokenType, RegExp, number ][] = [ + [ TOKEN_GENERAL, /^General/, 0 ] + ]; + if (reGeneral) { + handlers.push([ TOKEN_GENERAL, reGeneral, 0 ]); + } + handlers.push( + [ TOKEN_HASH, /^#/, 0 ], + [ TOKEN_ZERO, /^0/, 0 ], + [ TOKEN_QMARK, /^\?/, 0 ], + [ TOKEN_SLASH, /^\//, 0 ], + [ TOKEN_BREAK, /^;/, 0 ], + [ TOKEN_TEXT, /^@/, 0 ], + [ TOKEN_PLUS, /^\+/, 0 ], + [ TOKEN_MINUS, /^-/, 0 ], + [ TOKEN_POINT, /^\./, 0 ], + [ TOKEN_SPACE, /^ /, 0 ], + [ TOKEN_PERCENT, /^%/, 0 ], + [ TOKEN_CURRENCY, reCurrencySymbol, 0 ] + ); + if (reCurrency) { + handlers.push([ TOKEN_CURRENCY, reCurrency, 0 ]); + } + handlers.push( + [ TOKEN_DIGIT, /^[1-9]/, 0 ], + [ TOKEN_CALENDAR, /^(?:B[12])/i, 0 ], + [ TOKEN_ERROR, /^B$/, 0 ], // pattern must not end in a "B" + // [ TOKEN_DATETIME, /^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/, 0 ], + [ TOKEN_DATETIME, reDatetime, 0 ], + // [ TOKEN_DURATION, /^(?:\[(h+|m+|s+)\])/i, 1 ], + [ TOKEN_DURATION, reDuration, 1 ], + [ TOKEN_CONDITION, /^\[((?:<[=>]?|>=?|=)\s*(?:-?[.\d]+))\]/, 1 ], + [ TOKEN_DBNUM, /^\[(DBNum[0-4]?\d)\]/i, 1 ], + [ TOKEN_NATNUM, /^\[(NatNum[0-4]?\d)\]/i, 1 ], + [ TOKEN_LOCALE, /^\[\$([^\]]+)\]/, 1 ], + [ TOKEN_COLOR, /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i, 1 ] + ); + if (reColors) { + handlers.push([ TOKEN_COLOR, reColors, 1 ]); + } + if (reColor) { + handlers.push([ TOKEN_COLOR, reColor, 1 ]); + } + handlers.push( + // conditionally allow these open ended directions? + [ TOKEN_MODIFIER, /^\[([^\]]+)\]/, 1 ], + [ TOKEN_AMPM, /^(?:AM\/PM|am\/pm|A\/P)/, 0 ], + [ TOKEN_ESCAPED, /^\\(.)/, 1 ], + [ TOKEN_STRING, /^"([^"]*?)"/, 1 ], + [ TOKEN_SKIP, /^_(\\.|.)/, 1 ], + // Google Sheets and Excel diverge on "e": Excel only accepts E. + [ TOKEN_EXP, /^[Ee]([+-])/, 1 ], + [ TOKEN_FILL, /^\*(\\.|.)/, 1 ], + [ TOKEN_PAREN, /^[()]/, 0 ], + [ TOKEN_ERROR, /^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/, 0 ], + [ TOKEN_CHAR, /^./, 0 ] + ); + return handlers; +} diff --git a/lib/tokenize.ts b/lib/tokenize.ts index 8a70ed0..120e8f1 100644 --- a/lib/tokenize.ts +++ b/lib/tokenize.ts @@ -1,55 +1,7 @@ -import { - TOKEN_GENERAL, TOKEN_HASH, TOKEN_ZERO, TOKEN_QMARK, TOKEN_SLASH, TOKEN_GROUP, TOKEN_SCALE, - TOKEN_COMMA, TOKEN_BREAK, TOKEN_TEXT, TOKEN_PLUS, TOKEN_MINUS, TOKEN_POINT, TOKEN_SPACE, - TOKEN_PERCENT, TOKEN_DIGIT, TOKEN_CALENDAR, TOKEN_ERROR, TOKEN_DATETIME, TOKEN_DURATION, - TOKEN_CONDITION, TOKEN_DBNUM, TOKEN_NATNUM, TOKEN_LOCALE, TOKEN_COLOR, TOKEN_MODIFIER, - TOKEN_AMPM, TOKEN_ESCAPED, TOKEN_STRING, TOKEN_SKIP, TOKEN_EXP, TOKEN_FILL, TOKEN_PAREN, - TOKEN_CHAR -} from './constants.ts'; +import { TOKEN_GROUP, TOKEN_SCALE, TOKEN_COMMA, TOKEN_CHAR } from './constants.ts'; +import { TOKEN_HANDLERS } from './tokenHandlers.ts'; import type { Token, TokenType } from './types.ts'; -const tokenHandlers: [ TokenType, RegExp, number ][] = [ - [ TOKEN_GENERAL, /^General/i, 0 ], - [ TOKEN_HASH, /^#/, 0 ], - [ TOKEN_ZERO, /^0/, 0 ], - [ TOKEN_QMARK, /^\?/, 0 ], - [ TOKEN_SLASH, /^\//, 0 ], - // Commas are dealt with as a special case in the tokenizer but will end up - // as one of these: - // [ TOKEN_GROUP, /^(,),*/, 1 ], - // [ TOKEN_SCALE, /^(,),*/, 1 ], - // [ TOKEN_COMMA, /^(,),*/, 1 ], - [ TOKEN_BREAK, /^;/, 0 ], - [ TOKEN_TEXT, /^@/, 0 ], - [ TOKEN_PLUS, /^\+/, 0 ], - [ TOKEN_MINUS, /^-/, 0 ], - [ TOKEN_POINT, /^\./, 0 ], - [ TOKEN_SPACE, /^ /, 0 ], - [ TOKEN_PERCENT, /^%/, 0 ], - [ TOKEN_DIGIT, /^[1-9]/, 0 ], - [ TOKEN_CALENDAR, /^(?:B[12])/i, 0 ], - [ TOKEN_ERROR, /^B$/, 0 ], // pattern must not end in a "B" - [ TOKEN_DATETIME, /^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/, 0 ], - [ TOKEN_DURATION, /^(?:\[(h+|m+|s+)\])/i, 1 ], - [ TOKEN_CONDITION, /^\[((?:<[=>]?|>=?|=)\s*(?:-?[.\d]+))\]/, 1 ], - [ TOKEN_DBNUM, /^\[(DBNum[0-4]?\d)\]/i, 1 ], - [ TOKEN_NATNUM, /^\[(NatNum[0-4]?\d)\]/i, 1 ], - [ TOKEN_LOCALE, /^\[\$([^\]]+)\]/, 1 ], - [ TOKEN_COLOR, /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i, 1 ], - // conditionally allow these open ended directions? - [ TOKEN_MODIFIER, /^\[([^\]]+)\]/, 1 ], - [ TOKEN_AMPM, /^(?:AM\/PM|am\/pm|A\/P)/, 0 ], - [ TOKEN_ESCAPED, /^\\(.)/, 1 ], - [ TOKEN_STRING, /^"([^"]*?)"/, 1 ], - [ TOKEN_SKIP, /^_(\\.|.)/, 1 ], - // Google Sheets and Excel diverge on "e": Excel only accepts E. - [ TOKEN_EXP, /^[Ee]([+-])/, 1 ], - [ TOKEN_FILL, /^\*(\\.|.)/, 1 ], - [ TOKEN_PAREN, /^[()]/, 0 ], - [ TOKEN_ERROR, /^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/, 0 ], - [ TOKEN_CHAR, /^./, 0 ] -]; - const CODE_QMRK = 63; const CODE_HASH = 35; const CODE_ZERO = 48; @@ -59,24 +11,7 @@ const isNumOp = (char: string) => { return (c === CODE_QMRK || c === CODE_HASH || (c >= CODE_ZERO && c <= CODE_NINE)); }; -/** - * Breaks a format pattern string into a list of tokens. - * - * The returned output will be an array of objects representing the tokens: - * - * ```js - * [ - * { type: TOKEN_ZERO, value: '0', raw: '0' }, - * { type: TOKEN_POINT, value: '.', raw: '.' }, - * { type: TOKEN_ZERO, value: '0', raw: '0' }, - * { type: TOKEN_PERCENT, value: '%', raw: '%' } - * ] - * ``` - * - * @param pattern The format pattern - * @returns A list of tokens - */ -export function tokenize (pattern: string): Token[] { +export function lexer (pattern: string, handlers: [ TokenType, RegExp, number ][]): Token[] { let i = 0; const tokens: Token[] = []; const unresolvedCommas = []; @@ -130,7 +65,7 @@ export function tokenize (pattern: string): Token[] { // all other symbols are matched using else { let token: Token | undefined; - for (const [ type, expr, group ] of tokenHandlers) { + for (const [ type, expr, group ] of handlers) { const m = expr.exec(curr); if (m) { token = { type, value: m[group || 0], raw: m[0] }; @@ -158,3 +93,24 @@ export function tokenize (pattern: string): Token[] { } return tokens; } + +/** + * Breaks a format pattern string into a list of tokens. + * + * The returned output will be an array of objects representing the tokens: + * + * ```js + * [ + * { type: TOKEN_ZERO, value: '0', raw: '0' }, + * { type: TOKEN_POINT, value: '.', raw: '.' }, + * { type: TOKEN_ZERO, value: '0', raw: '0' }, + * { type: TOKEN_PERCENT, value: '%', raw: '%' } + * ] + * ``` + * + * @param pattern The format pattern + * @returns A list of tokens + */ +export function tokenize (pattern: string): Token[] { + return lexer(pattern, TOKEN_HANDLERS); +} diff --git a/lib/types.ts b/lib/types.ts index 4a629e7..c878bd6 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -6,7 +6,8 @@ import { TOKEN_PAREN, TOKEN_CHAR, TOKEN_MODIFIER, TOKEN_DBNUM, TOKEN_NATNUM, TOKEN_DATETIME, TOKEN_LOCALE, TOKEN_ESCAPED, T_TYPE_INT, T_TYPE_NUM, T_TYPE_DEN, T_TYPE_DIV, T_TYPE_FRAC, T_TYPE_MAN, T_TYPE_SUBSEC, T_TYPE_YEAR_S, T_TYPE_YEAR, T_TYPE_B_YEAR_S, T_TYPE_B_YEAR, T_TYPE_DAY, T_TYPE_WEEKDAY_S, T_TYPE_WEEKDAY, T_TYPE_HOUR, T_TYPE_MNAME_S, - T_TYPE_MNAME_1, T_TYPE_MNAME, T_TYPE_MIN, T_TYPE_MON, T_TYPE_HOUR_E, T_TYPE_MIN_E, T_TYPE_SEC_E, T_TYPE_SEC + T_TYPE_MNAME_1, T_TYPE_MNAME, T_TYPE_MIN, T_TYPE_MON, T_TYPE_HOUR_E, T_TYPE_MIN_E, T_TYPE_SEC_E, T_TYPE_SEC, + TOKEN_CURRENCY } from './constants.ts'; @@ -22,6 +23,7 @@ import { * | TOKEN_COLOR | Color modifier (`[Black]`, `[color 5]`) * | TOKEN_COMMA | Plain non-operator comma (`,`) * | TOKEN_CONDITION | Condition modifier for a section (`[>=10]`) + * | TOKEN_CURRENCY | A currency character (`$`) * | TOKEN_DATETIME | Date-time operator (`mmmm`, `YY`) * | TOKEN_DBNUM | Number display modifier (`[DBNum23]`) * | TOKEN_DIGIT | A digit between 1 and 9 (`3`) @@ -59,7 +61,7 @@ export type TokenType = ( typeof TOKEN_CONDITION | typeof TOKEN_DBNUM | typeof TOKEN_NATNUM | typeof TOKEN_LOCALE | typeof TOKEN_COLOR | typeof TOKEN_MODIFIER | typeof TOKEN_AMPM | typeof TOKEN_ESCAPED | typeof TOKEN_STRING | typeof TOKEN_SKIP | typeof TOKEN_EXP | typeof TOKEN_FILL | - typeof TOKEN_PAREN | typeof TOKEN_CHAR + typeof TOKEN_PAREN | typeof TOKEN_CHAR | typeof TOKEN_CURRENCY ); /** @@ -99,6 +101,7 @@ export type RenderToken = DateRenderToken | { type: typeof TOKEN_TEXT, value: string } | { type: typeof TOKEN_POINT, value: string } | + { type: typeof TOKEN_CURRENCY, value: string } | { type: typeof TOKEN_STRING, value: string, rule?: RenderRule } | { type: typeof TOKEN_SPACE, rule?: RenderRule } | { type: typeof TOKEN_FILL, value: string } | diff --git a/test/delocalize.spec.ts b/test/delocalize.spec.ts new file mode 100644 index 0000000..38e0ba5 --- /dev/null +++ b/test/delocalize.spec.ts @@ -0,0 +1,287 @@ +import { describe, expect, test } from 'vitest'; +import { delocalize } from '../lib/delocalize.ts'; + +describe('delocalize', () => { + test('english', () => { + const opts = 'en'; + expect(delocalize('YY-MM-DD HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + + expect(delocalize('#,##0.00', opts)).toBe('#,##0.00'); + expect(delocalize('#.##0,00', opts)).toBe('#.##0,00'); + + expect(delocalize('[color7]0', opts)).toBe('[color7]0'); + expect(delocalize('[color 7]0', opts)).toBe('[color 7]0'); + expect(delocalize('[black]0', opts)).toBe('[black]0'); + expect(delocalize('[blue]0', opts)).toBe('[blue]0'); + expect(delocalize('[cyan]0', opts)).toBe('[cyan]0'); + expect(delocalize('[green]0', opts)).toBe('[green]0'); + expect(delocalize('[magenta]0', opts)).toBe('[magenta]0'); + expect(delocalize('[red]0', opts)).toBe('[red]0'); + expect(delocalize('[white]0', opts)).toBe('[white]0'); + expect(delocalize('[yellow]0', opts)).toBe('[yellow]0'); + + expect(delocalize('0 $', opts)).toBe('0 $'); + + // collapsing strings & chars works as expected + expect(delocalize('0.0 foo"bar"."b"az', opts)).toBe('0.0 "foobar.baz"'); + expect(delocalize('0.0 foo"bar".xxx', opts)).toBe('0.0 "foobar.xxx"'); + expect(delocalize('0 \\y\\ear\\s', opts)).toBe('0 "years"'); + expect(delocalize('xx_(xx', opts)).toBe('"xx"_("xx"'); + expect(delocalize('xx*(xx', opts)).toBe('"xx"*("xx"'); + expect(delocalize('"x"\\""x"', opts)).toBe('"x"\\""x"'); + expect(delocalize('x\\"x', opts)).toBe('"x"\\""x"'); + }); + + test('english, UK', () => { + const opts = 'en-GB'; + expect(delocalize('YY-MM-DD HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + + expect(delocalize('#,##0.00', opts)).toBe('#,##0.00'); + expect(delocalize('#.##0,00', opts)).toBe('#.##0,00'); + + expect(delocalize('[Colour7]0', opts)).toBe('[Color7]0'); + expect(delocalize('[Colour 7]0', opts)).toBe('[Color 7]0'); + expect(delocalize('[Black]0', opts)).toBe('[Black]0'); + expect(delocalize('[Blue]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Cyan]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Green]0', opts)).toBe('[Green]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + expect(delocalize('[Red]0', opts)).toBe('[Red]0'); + expect(delocalize('[White]0', opts)).toBe('[White]0'); + expect(delocalize('[Yellow]0', opts)).toBe('[Yellow]0'); + }); + + test('german', () => { + const opts = 'de'; + expect(delocalize('JJ-MM-TT HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + expect(delocalize('Standard', opts)).toBe('General'); + + expect(delocalize('[Color7]0', opts)).toBe('[Color7]0'); + expect(delocalize('[Schwarz]0', opts)).toBe('[Black]0'); + expect(delocalize('[Blau]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Cyan]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Grün]0', opts)).toBe('[Green]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + expect(delocalize('[Rot]0', opts)).toBe('[Red]0'); + expect(delocalize('[Weiß]0', opts)).toBe('[White]0'); + expect(delocalize('[Gelb]0', opts)).toBe('[Yellow]0'); + + // swiss german: group: "'", decimal: '.' + const opts2 = 'de-CH'; + expect(delocalize('#,##0.00', opts2)).toBe('#,##0.00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + expect(delocalize('#’##0.00', opts2)).toBe('#,##0.00'); + expect(delocalize('#\'##0.00', opts2)).toBe('#,##0.00'); + expect(delocalize('$ #’##0;$ -#’##0', opts2)).toBe('$ #,##0;$ -#,##0'); + expect(delocalize('CHF #’##0;CHF -#’##0', opts2)).toBe('"CHF" #,##0;"CHF" -#,##0'); + }); + + test('dutch', () => { + const opts = 'nl'; + expect(delocalize('JJ-MM-DD UU:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + expect(delocalize('[U]', opts)).toBe('[H]'); + expect(delocalize('[UUU]', opts)).toBe('[H]'); + expect(delocalize('Standaard', opts)).toBe('General'); + + expect(delocalize('[Zwart]0', opts)).toBe('[Black]0'); + expect(delocalize('[Blauw]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Cyaan]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Groen]0', opts)).toBe('[Green]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + expect(delocalize('[Root]0', opts)).toBe('[Red]0'); + expect(delocalize('[Wit]0', opts)).toBe('[White]0'); + expect(delocalize('[Geel]0', opts)).toBe('[Yellow]0'); + }); + + test('danish', () => { + const opts = 'da'; + expect(delocalize('ÅÅ-MM-DD TT:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + + expect(delocalize('_-* #.##0 kr._-;-* #.##0 kr._-;_-* "-" kr._-;_-@_-', opts)) + .toBe('_-* #,##0 "kr."_-;-* #,##0 "kr."_-;_-* "-" "kr."_-;_-@_-'); + expect(delocalize('#.##0 kr.;[Red]-#.##0 kr.', opts)) + .toBe('#,##0 "kr.";[Red]-#,##0 "kr."'); + + expect(delocalize('Standard', opts)).toBe('General'); + expect(delocalize('[Farve 7]0', opts)).toBe('[Color 7]0'); + expect(delocalize('[Sort]0', opts)).toBe('[Black]0'); + expect(delocalize('[Blå]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Akvamarin]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Lysegrøn]0', opts)).toBe('[Green]0'); + expect(delocalize('[Lyslilla]0', opts)).toBe('[Magenta]0'); + expect(delocalize('[Rød]0', opts)).toBe('[Red]0'); + expect(delocalize('[Hvid]0', opts)).toBe('[White]0'); + expect(delocalize('[Gul]0', opts)).toBe('[Yellow]0'); + + expect(delocalize('#.##0,00 "Kr"', opts)).toBe('#,##0.00 "Kr"'); + expect(delocalize('#.##0,00 "sikrer"', opts)).toBe('#,##0.00 "sikrer"'); + expect(delocalize('#.##0,00 "siKrer"', opts)).toBe('#,##0.00 "siKrer"'); + expect(delocalize('#.##0,00 "si Kr er"', opts)).toBe('#,##0.00 "si Kr er"'); + expect(delocalize('#.##0,00 \\si Kr \\er', opts)).toBe('#,##0.00 "si" "Kr" "er"'); + expect(delocalize('#.##0,00 \\siKr\\er', opts)).toBe('#,##0.00 "siKrer"'); + expect(delocalize('#.##0,00 lKrl', opts)).toBe('#,##0.00 "lKrl"'); + expect(delocalize('#.##0,00 \\lKr\\l', opts)).toBe('#,##0.00 "lKrl"'); + expect(delocalize('#.##0,00 "l"Kr"l"', opts)).toBe('#,##0.00 "lKrl"'); + }); + + test('swedish', () => { + const opts = 'sv'; + expect(delocalize('ÅÅ-MM-DD TT:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + expect(delocalize('Standard', opts)).toBe('General'); + expect(delocalize('[Färg 7]0', opts)).toBe('[Color 7]0'); + expect(delocalize('[Svart]0', opts)).toBe('[Black]0'); + expect(delocalize('[Blå]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Cyanblå]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Grön]0', opts)).toBe('[Green]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + expect(delocalize('[Röd]0', opts)).toBe('[Red]0'); + expect(delocalize('[Vit]0', opts)).toBe('[White]0'); + expect(delocalize('[Gul]0', opts)).toBe('[Yellow]0'); + }); + + test('norwegian', () => { + { + const opts = 'no'; + expect(delocalize('ÅÅ-MM-DD TT:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + + expect(delocalize('Standard', opts)).toBe('General'); + expect(delocalize('[Farge 7]0', opts)).toBe('[Color 7]0'); + expect(delocalize('[Svart]0', opts)).toBe('[Black]0'); + expect(delocalize('[Blå]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Cyan]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Grønn]0', opts)).toBe('[Green]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + expect(delocalize('[Rød]0', opts)).toBe('[Red]0'); + expect(delocalize('[Hvit]0', opts)).toBe('[White]0'); + expect(delocalize('[Gul]0', opts)).toBe('[Yellow]0'); + } + { + const opts = 'nb'; + expect(delocalize('åå-MM-DD TT:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + } + }); + + test('finnish', () => { + const opts = 'fi'; + expect(delocalize('VV-KK-PP TT:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + // XXX: need to confirm that colors are in english + }); + + test('french', () => { + const opts = 'fr'; + expect(delocalize('AA-MM-JJ HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + + expect(delocalize('[Color7]0', opts)).toBe('[Color7]0'); + expect(delocalize('[Noir]0', opts)).toBe('[Black]0'); + expect(delocalize('[Bleu]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Cyan]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Vert]0', opts)).toBe('[Green]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + expect(delocalize('[Rouge]0', opts)).toBe('[Red]0'); + expect(delocalize('[Blanc]0', opts)).toBe('[White]0'); + expect(delocalize('[Jaune]0', opts)).toBe('[Yellow]0'); + + expect(delocalize('_ * # ##0_)_ ;_ * (# ##0)_ ;_ * "-"_)_ ;_ @_ ', opts)) + .toBe('_ * #,##0_)_ ;_ * (#,##0)_ ;_ * "-"_)_ ;_ @_ '); + expect(delocalize('# ##0,0 "Fr"', opts)).toBe('#,##0.0 "Fr"'); + }); + + test('spanish', () => { + const opts = 'es'; + expect(delocalize('AA-MM-DD HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + + expect(delocalize('[Color7]0', opts)).toBe('[Color7]0'); + expect(delocalize('[Negro]0', opts)).toBe('[Black]0'); + expect(delocalize('[Blanco]0', opts)).toBe('[White]0'); + expect(delocalize('[Rojo]0', opts)).toBe('[Red]0'); + expect(delocalize('[Verde]0', opts)).toBe('[Green]0'); + expect(delocalize('[Azul]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Amarillo]0', opts)).toBe('[Yellow]0'); + expect(delocalize('[Cian]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Ciano]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + }); + + test('italian', () => { + const opts = 'it'; + expect(delocalize('AA-MM-GG HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + + expect(delocalize('[Color7]0', opts)).toBe('[Color7]0'); + expect(delocalize('[Nero]0', opts)).toBe('[Black]0'); + expect(delocalize('[Bianco]0', opts)).toBe('[White]0'); + expect(delocalize('[Rosso]0', opts)).toBe('[Red]0'); + expect(delocalize('[Verde]0', opts)).toBe('[Green]0'); + expect(delocalize('[Blu]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Giallo]0', opts)).toBe('[Yellow]0'); + expect(delocalize('[Ciano]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Celeste]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + }); + + test('portuguese', () => { + const opts = 'pt'; + expect(delocalize('AA-MM-DD HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + expect(delocalize('#\u202f##0,00', opts)).toBe('#,##0.00'); + expect(delocalize('# ##0,00', opts)).toBe('#,##0.00'); + + expect(delocalize('Estandar "Estandar"', opts)).toBe('General "Estandar"'); + + expect(delocalize('[Color7]0', opts)).toBe('[Color7]0'); + + expect(delocalize('[Preto]0', opts)).toBe('[Black]0'); + expect(delocalize('[Branco]0', opts)).toBe('[White]0'); + expect(delocalize('[Vermelho]0', opts)).toBe('[Red]0'); + expect(delocalize('[Verde]0', opts)).toBe('[Green]0'); + expect(delocalize('[Azul]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Amarelo]0', opts)).toBe('[Yellow]0'); + expect(delocalize('[Ciano]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Turquesa]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Magenta]0', opts)).toBe('[Magenta]0'); + }); + + test('russian', () => { + const opts = 'ru'; + expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); + expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); + + expect(delocalize('[Color7]0', opts)).toBe('[Color7]0'); + expect(delocalize('[Цвет7]0', opts)).toBe('[Color7]0'); + + expect(delocalize('[Черный]0', opts)).toBe('[Black]0'); + expect(delocalize('[Белый]0', opts)).toBe('[White]0'); + expect(delocalize('[Красный]0', opts)).toBe('[Red]0'); + expect(delocalize('[Зеленый]0', opts)).toBe('[Green]0'); + expect(delocalize('[Синий]0', opts)).toBe('[Blue]0'); + expect(delocalize('[Желтый]0', opts)).toBe('[Yellow]0'); + expect(delocalize('[Голубой]0', opts)).toBe('[Cyan]0'); + expect(delocalize('[Пурпурный]0', opts)).toBe('[Magenta]0'); + expect(delocalize('[Фиолетовый]0', opts)).toBe('[Magenta]0'); + }); +}); diff --git a/test/info.spec.ts b/test/info.spec.ts index 7424ac4..238c489 100644 --- a/test/info.spec.ts +++ b/test/info.spec.ts @@ -309,23 +309,6 @@ test('Currency', () => { maxDecimals: 4, level: 10.4 }); - - // can pass in own currency - const testCurrency = (str: string, identifier: string, code: string) => { - const info = getFormatInfo(str, { currency: identifier }); - expect(info.code, str).toBe(code); - }; - // Excel doesn't really have a great solution to this: - // It just contorts the string to ensure that the current - // currency identifier is a separate token when parsed. - testCurrency('#,##0.00 "ISK"', 'ISK', 'C2'); - testCurrency('#,##0\\ "fiskur"', 'ISK', ',0'); - testCurrency('#,##0\\ "fISKur"', 'ISK', ',0'); - testCurrency('#,##0\\ "f ISK ur"', 'ISK', ',0'); - testCurrency('#,##0\\ \\f"ISK"\\u\\r', 'ISK', 'C0'); - testCurrency('#,##0\\ "ISK"', 'ISK', 'C0'); - testCurrency('#,##0\\a"ISK"\\a', 'ISK', 'C0'); - testCurrency('#,##0"aISKa"', 'ISK', ',0'); }); test('Percentages', () => { From 027580c122a992db9b6930faff392bd7c9b57768 Mon Sep 17 00:00:00 2001 From: Borgar Date: Mon, 28 Sep 2026 17:32:45 +0000 Subject: [PATCH 2/4] Complete delocalize and mostly correct locale data --- lib/delocalize.ts | 23 +++++-- lib/formatInfo.ts | 2 +- lib/locale.ts | 5 +- lib/locales.ts | 20 +++--- lib/tokenHandlers.ts | 138 +++++++++++----------------------------- lib/tokenize.ts | 5 +- test/delocalize.spec.ts | 3 + 7 files changed, 75 insertions(+), 121 deletions(-) diff --git a/lib/delocalize.ts b/lib/delocalize.ts index d54c548..1740588 100644 --- a/lib/delocalize.ts +++ b/lib/delocalize.ts @@ -1,4 +1,4 @@ -import { TOKEN_CHAR, TOKEN_COLOR, TOKEN_COMMA, TOKEN_CURRENCY, TOKEN_DATETIME, TOKEN_DURATION, TOKEN_ESCAPED, TOKEN_GENERAL, TOKEN_GROUP, TOKEN_HASH, TOKEN_MODIFIER, TOKEN_POINT, TOKEN_QMARK, TOKEN_SPACE, TOKEN_STRING, TOKEN_ZERO } from './constants.ts'; +import { TOKEN_AMPM, TOKEN_CHAR, TOKEN_COLOR, TOKEN_COMMA, TOKEN_CURRENCY, TOKEN_DATETIME, TOKEN_DURATION, TOKEN_ESCAPED, TOKEN_GENERAL, TOKEN_GROUP, TOKEN_HASH, TOKEN_MODIFIER, TOKEN_POINT, TOKEN_QMARK, TOKEN_SPACE, TOKEN_STRING, TOKEN_ZERO } from './constants.ts'; import { defaultLocale, getLocale, parseLocale, resolveLocale } from './locale.ts'; import { getTokenHandlers } from './tokenHandlers.ts'; import { lexer } from './tokenize.ts'; @@ -61,11 +61,10 @@ export function delocalize (pattern: string, fromLocale: string | number): strin const flipNum = l10n?.decimal !== '.'; const wsGroup = /^\s$/.test(l10n.group); - // Translate tokens + const handlers = getTokenHandlers(l10n); const tokens = lexer(pattern, handlers); - // setup const colorTag = (l10n.color ?? 'Color').toLowerCase(); const colorNames = l10n.colors ?? COLORS; const opcodes = l10n.opcodes; @@ -90,6 +89,9 @@ export function delocalize (pattern: string, fromLocale: string | number): strin out.push(t); } } + else if (opcodes && type === TOKEN_AMPM) { + out.push({ type: TOKEN_AMPM, value: '', raw: 'AM/PM' }); + } else if (opcodes && type === TOKEN_DATETIME) { const lc1 = t.value.charAt(0).toLowerCase(); if (opcodes.dy && lc1 === opcodes.dy) { @@ -107,6 +109,12 @@ export function delocalize (pattern: string, fromLocale: string | number): strin else if (opcodes.ts && lc1 === opcodes.ts) { out.push({ type: TOKEN_DATETIME, value: '', raw: 'S'.repeat(t.value.length) }); } + else if (opcodes.wd && lc1 === opcodes.wd) { + out.push({ type: TOKEN_DATETIME, value: '', raw: 'A'.repeat(t.value.length) }); + } + else if (opcodes.en && lc1 === opcodes.en) { + out.push({ type: TOKEN_DATETIME, value: '', raw: 'G'.repeat(t.value.length) }); + } else { out.push(t); } @@ -151,12 +159,12 @@ export function delocalize (pattern: string, fromLocale: string | number): strin s += t.raw; } else if (t.type === TOKEN_CURRENCY) { - const as_str = /[a-z]/i.test(t.raw); - if (inStr && !as_str) { + const needEscaping = /[a-z.]/i.test(t.raw); + if (inStr && !needEscaping) { s += '"'; inStr = false; } - else if (!inStr && as_str) { + else if (!inStr && needEscaping) { s += '"'; inStr = true; } @@ -170,7 +178,8 @@ export function delocalize (pattern: string, fromLocale: string | number): strin s += t.raw; } else if (t.type === TOKEN_ESCAPED || t.type === TOKEN_STRING) { - if (!inStr) { + // XXX: unsure if this single space string case is used for much other than built ins? + if (!inStr && t.value !== ' ') { s += '"'; inStr = true; } diff --git a/lib/formatInfo.ts b/lib/formatInfo.ts index 3e3d755..54122b5 100644 --- a/lib/formatInfo.ts +++ b/lib/formatInfo.ts @@ -1,4 +1,4 @@ -import { u_YEAR, u_MONTH, u_DAY, u_HOUR, u_MIN, u_SEC, TOKEN_STRING, T_TYPE_YEAR, T_TYPE_YEAR_S, T_TYPE_B_YEAR, T_TYPE_B_YEAR_S, T_TYPE_MON, T_TYPE_MNAME, T_TYPE_MNAME_S, T_TYPE_MNAME_1, T_TYPE_WEEKDAY, T_TYPE_WEEKDAY_S, T_TYPE_DAY, T_TYPE_HOUR, T_TYPE_MIN, T_TYPE_SEC, TOKEN_AMPM, TOKEN_CURRENCY } from './constants.ts'; +import { u_YEAR, u_MONTH, u_DAY, u_HOUR, u_MIN, u_SEC, T_TYPE_YEAR, T_TYPE_YEAR_S, T_TYPE_B_YEAR, T_TYPE_B_YEAR_S, T_TYPE_MON, T_TYPE_MNAME, T_TYPE_MNAME_S, T_TYPE_MNAME_1, T_TYPE_WEEKDAY, T_TYPE_WEEKDAY_S, T_TYPE_DAY, T_TYPE_HOUR, T_TYPE_MIN, T_TYPE_SEC, TOKEN_AMPM, TOKEN_CURRENCY } from './constants.ts'; import type { FormatDateInfo, FormatInfo, Partition } from './types.ts'; export function isPercent (partitions: Partition[]): boolean { diff --git a/lib/locale.ts b/lib/locale.ts index 5e12ce8..f496b55 100644 --- a/lib/locale.ts +++ b/lib/locale.ts @@ -127,6 +127,8 @@ export type LocaleData = { * - `th`: Hours of time, defaults to `h`. * - `tm`: Minutes of time, defaults to `m`. * - `ts`: Seconds of time, defaults to `s`. + * - `wd`: Weekday (alt.), defaults to `a`. + * - `en`: Era name, defaults to `g`. */ opcodes?: { dy?: string, @@ -135,7 +137,8 @@ export type LocaleData = { th?: string, tm?: string, ts?: string, - // ap?: string, + wd?: string, + en?: string, }, /** * The currency symbol used by the Locale. diff --git a/lib/locales.ts b/lib/locales.ts index 25c3db7..9be00f5 100644 --- a/lib/locales.ts +++ b/lib/locales.ts @@ -301,7 +301,7 @@ export function initLocales () { magenta: 'Magenta', cyan: 'Cyan' }, - opcodes: { dy: 'a', dd: 'j' }, + opcodes: { dy: 'a', dd: 'j', wd: 'o' }, general: 'Standard' }, -1, -13); addLocale({ ..._fr, currency: '€' }, 'fr'); @@ -425,12 +425,12 @@ export function initLocales () { celeste: 'Cyan', // mac ciano: 'Cyan' // win }, - opcodes: { dy: 'a', dd: 'g' } + opcodes: { dy: 'a', dd: 'g', wd: 'o', en: 'x' } }, 3, 3); addLocale({ group: '.', decimal: ',', ..._it, currency: '€' }, 'it'); addLocale({ group: '’', decimal: '.', ..._it, currency: 'CHF' }, 'it-CH'); - const _no: LocaleData = { + const _no = { decimal: ',', ampm: _B('a.m.;p.m.'), mmmm: _M('januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember'), @@ -477,12 +477,12 @@ export function initLocales () { currency: 'zł' }, 3, -1), 'pl'); - const _pt: LocaleData = { + const _pt = { decimal: ',', mmmm: _M('janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro'), dddd: _W('domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado'), bool: _B('VERDADEIRO;FALSO'), - opcodes: { dy: 'a' }, + opcodes: { dy: 'a', wd: 'o' }, color: 'Cor' }; addLocale({ @@ -565,7 +565,7 @@ export function initLocales () { currency: '€' }, 3, 2), 'sk'); - const _es: LocaleData = { + const _es = { group: '.', decimal: ',', ampm: _B('a.\u00A0m.;p.\u00A0m.'), @@ -588,7 +588,7 @@ export function initLocales () { }; const _esM3 = _M('ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic'); const _esM3s = _M('ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic'); - addLocale({ ..._es, ddd: _W('do;lu;ma;mi;ju;vi;sá'), general: 'Estándar', opcodes: { dy: 'a' }, currency: '€' }, 'es'); + addLocale({ ..._es, ddd: _W('do;lu;ma;mi;ju;vi;sá'), general: 'Estándar', opcodes: { dy: 'a', wd: 'o' }, currency: '€' }, 'es'); addLocale({ ..._es, mmm: _esM3s }, 'es-AR'); addLocale({ ..._es, mmm: _esM3s, currency: 'Bs' }, 'es-BO'); addLocale({ ..._es, mmm: _esM3s }, 'es-CL'); @@ -601,7 +601,7 @@ export function initLocales () { decimal: '.', mmm: _esM3, ampm: _B('a.m.;p.m.'), - opcodes: { dy: 'a' }, + opcodes: { dy: 'a', wd: 'o' }, general: 'Estándar' }, 'es-MX'); addLocale({ @@ -710,7 +710,7 @@ export function initLocales () { dddd: _W('diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte'), ddd: _W('dg;dl;dt;dc;dj;dv;ds'), general: 'Estándar', - opcodes: { dy: 'a' }, + opcodes: { dy: 'a', wd: 'o' }, ampm: _B('a.\u00a0m.;p.\u00a0m.'), currency: '€' }, 'ca'); @@ -969,7 +969,7 @@ export function initLocales () { addLocale({ group: ',', decimal: '.', - ampm: [ '.AM', '.PM' ], + ampm: [ 'AM', 'PM' ], mmmm: _M('জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর'), mmm: _M('জানু;ফেব্রু;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগ;সেপ্টে;অক্টো;নভে;ডিসে'), dddd: _W('রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার'), diff --git a/lib/tokenHandlers.ts b/lib/tokenHandlers.ts index b31876c..15b0465 100644 --- a/lib/tokenHandlers.ts +++ b/lib/tokenHandlers.ts @@ -1,6 +1,6 @@ import { - TOKEN_GENERAL, TOKEN_HASH, TOKEN_ZERO, TOKEN_QMARK, TOKEN_SLASH, TOKEN_GROUP, TOKEN_SCALE, - TOKEN_COMMA, TOKEN_BREAK, TOKEN_TEXT, TOKEN_PLUS, TOKEN_MINUS, TOKEN_POINT, TOKEN_SPACE, + TOKEN_GENERAL, TOKEN_HASH, TOKEN_ZERO, TOKEN_QMARK, TOKEN_SLASH, + TOKEN_BREAK, TOKEN_TEXT, TOKEN_PLUS, TOKEN_MINUS, TOKEN_POINT, TOKEN_SPACE, TOKEN_PERCENT, TOKEN_DIGIT, TOKEN_CALENDAR, TOKEN_ERROR, TOKEN_DATETIME, TOKEN_DURATION, TOKEN_CONDITION, TOKEN_DBNUM, TOKEN_NATNUM, TOKEN_LOCALE, TOKEN_COLOR, TOKEN_MODIFIER, TOKEN_AMPM, TOKEN_ESCAPED, TOKEN_STRING, TOKEN_SKIP, TOKEN_EXP, TOKEN_FILL, TOKEN_PAREN, @@ -9,111 +9,64 @@ import { currencySymbols } from './constants.ts'; import type { LocaleData } from './locale.ts'; -import type { Token, TokenType } from './types.ts'; +import type { TokenType } from './types.ts'; const reEsc = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); export const reCurrencySymbol = new RegExp('^[' + reEsc(currencySymbols.join('')) + ']'); -export const TOKEN_HANDLERS: [ TokenType, RegExp, number ][] = [ - [ TOKEN_GENERAL, /^General/i, 0 ], - [ TOKEN_HASH, /^#/, 0 ], - [ TOKEN_ZERO, /^0/, 0 ], - [ TOKEN_QMARK, /^\?/, 0 ], - [ TOKEN_SLASH, /^\//, 0 ], - // Commas are dealt with as a special case in the tokenizer but will end up - // as one of these: - // [ TOKEN_GROUP, /^(,),*/, 1 ], - // [ TOKEN_SCALE, /^(,),*/, 1 ], - // [ TOKEN_COMMA, /^(,),*/, 1 ], - [ TOKEN_BREAK, /^;/, 0 ], - [ TOKEN_TEXT, /^@/, 0 ], - [ TOKEN_PLUS, /^\+/, 0 ], - [ TOKEN_MINUS, /^-/, 0 ], - [ TOKEN_POINT, /^\./, 0 ], - [ TOKEN_SPACE, /^ /, 0 ], - [ TOKEN_PERCENT, /^%/, 0 ], - [ TOKEN_CURRENCY, reCurrencySymbol, 0 ], - [ TOKEN_DIGIT, /^[1-9]/, 0 ], - [ TOKEN_CALENDAR, /^(?:B[12])/i, 0 ], - [ TOKEN_ERROR, /^B$/, 0 ], // pattern must not end in a "B" - [ TOKEN_DATETIME, /^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/, 0 ], - [ TOKEN_DURATION, /^(?:\[(h+|m+|s+)\])/i, 1 ], - [ TOKEN_CONDITION, /^\[((?:<[=>]?|>=?|=)\s*(?:-?[.\d]+))\]/, 1 ], - [ TOKEN_DBNUM, /^\[(DBNum[0-4]?\d)\]/i, 1 ], - [ TOKEN_NATNUM, /^\[(NatNum[0-4]?\d)\]/i, 1 ], - [ TOKEN_LOCALE, /^\[\$([^\]]+)\]/, 1 ], - [ TOKEN_COLOR, /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i, 1 ], - // conditionally allow these open ended directions? - [ TOKEN_MODIFIER, /^\[([^\]]+)\]/, 1 ], - [ TOKEN_AMPM, /^(?:AM\/PM|am\/pm|A\/P)/, 0 ], - [ TOKEN_ESCAPED, /^\\(.)/, 1 ], - [ TOKEN_STRING, /^"([^"]*?)"/, 1 ], - [ TOKEN_SKIP, /^_(\\.|.)/, 1 ], - // Google Sheets and Excel diverge on "e": Excel only accepts E. - [ TOKEN_EXP, /^[Ee]([+-])/, 1 ], - [ TOKEN_FILL, /^\*(\\.|.)/, 1 ], - [ TOKEN_PAREN, /^[()]/, 0 ], - [ TOKEN_ERROR, /^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/, 0 ], - [ TOKEN_CHAR, /^./, 0 ] -]; - export function getTokenHandlers (l10n: LocaleData): [ TokenType, RegExp, number ][] { - // match General - const reGeneral = !(l10n.general === 'General' || !l10n.general) - ? new RegExp(`^(?:General|${reEsc(l10n.general)})`, 'i') - : null; - - // colors - const reColors = l10n.colors - ? new RegExp(`^\\[(${Object.keys(l10n.colors).map(reEsc).join('|')})\\]`, 'i') - : null; + const handlers: [ TokenType, RegExp, number ][] = []; - const reColor = l10n.color - ? new RegExp(`^\\[(${reEsc(l10n.color)}\\s*\\d+)\\]`, 'i') - : null; + // match General + handlers.push([ TOKEN_GENERAL, /^General/i, 0 ]); + if (l10n.general && l10n.general !== 'General') { + handlers.push([ TOKEN_GENERAL, new RegExp(`^${reEsc(l10n.general)}`, 'i'), 0 ]); + } + // match translated color names and indexed color + if (l10n.colors) { + handlers.push([ TOKEN_COLOR, new RegExp(`^\\[(${Object.keys(l10n.colors).map(reEsc).join('|')})\\]`, 'i'), 1 ]); + } + if (l10n.color) { + handlers.push([ TOKEN_COLOR, new RegExp(`^\\[(${reEsc(l10n.color)}\\s*\\d+)\\]`, 'i'), 1 ]); + } - // + // match alternate locale date and time opcodes let reDatetime; let reDuration; if (l10n.opcodes) { - // console.log(l10n.opcodes); - const dy = l10n.opcodes.dy ?? 'y'; - const dm = l10n.opcodes.dm ?? 'm'; - const dd = l10n.opcodes.dd ?? 'd'; - const th = l10n.opcodes.th ?? 'h'; - const tm = l10n.opcodes.tm ?? 'm'; - const ts = l10n.opcodes.ts ?? 's'; + const dy = reEsc(l10n.opcodes.dy ?? 'y'); + const dm = reEsc(l10n.opcodes.dm ?? 'm'); + const dd = reEsc(l10n.opcodes.dd ?? 'd'); + const th = reEsc(l10n.opcodes.th ?? 'h'); + const tm = reEsc(l10n.opcodes.tm ?? 'm'); + const ts = reEsc(l10n.opcodes.ts ?? 's'); + const wd = reEsc(l10n.opcodes.wd ?? 'a'); + const en = reEsc(l10n.opcodes.en ?? 'g'); // AAA - const ddd = [ + const ops = [ dy + dy.toUpperCase(), dm + dm.toUpperCase(), dd + dd.toUpperCase(), th + th.toUpperCase(), tm + tm.toUpperCase(), ts + ts.toUpperCase(), - 'bB', - 'gG' + wd + wd.toUpperCase(), + en + en.toUpperCase(), + 'bB' ]; - // console.log(ddd); - // [aA]{3,} --- need to mine this 😭 - reDatetime = new RegExp(`^(?:[${ddd.join(']+|[')}]+|e+)`); - reDuration = new RegExp(`^(?:\\[(${th}+|${tm}+|${ts}+)\\]+)`, 'i'); + reDatetime = new RegExp(`^(?:[${ops.join(']+|[')}]+|e+)`); + reDuration = new RegExp(`^(?:\\[(${reEsc(th)}+|${reEsc(tm)}+|${reEsc(ts)}+)\\]+)`, 'i'); } else { reDatetime = /^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/; reDuration = /^(?:\[(h+|m+|s+)\])/i; } - const reCurrency = l10n.currency.length > 1 || !currencySymbols.includes(l10n.currency) - ? new RegExp(`^(?:${reEsc(l10n.currency)})`) - : null; - - const handlers: [ TokenType, RegExp, number ][] = [ - [ TOKEN_GENERAL, /^General/, 0 ] - ]; - if (reGeneral) { - handlers.push([ TOKEN_GENERAL, reGeneral, 0 ]); + // match currency from locale + if (l10n.currency.length > 1 || !currencySymbols.includes(l10n.currency)) { + handlers.push([ TOKEN_CURRENCY, new RegExp(`^(?:${reEsc(l10n.currency)})`), 0 ]); } + handlers.push( [ TOKEN_HASH, /^#/, 0 ], [ TOKEN_ZERO, /^0/, 0 ], @@ -126,35 +79,20 @@ export function getTokenHandlers (l10n: LocaleData): [ TokenType, RegExp, number [ TOKEN_POINT, /^\./, 0 ], [ TOKEN_SPACE, /^ /, 0 ], [ TOKEN_PERCENT, /^%/, 0 ], - [ TOKEN_CURRENCY, reCurrencySymbol, 0 ] - ); - if (reCurrency) { - handlers.push([ TOKEN_CURRENCY, reCurrency, 0 ]); - } - handlers.push( + [ TOKEN_CURRENCY, reCurrencySymbol, 0 ], [ TOKEN_DIGIT, /^[1-9]/, 0 ], [ TOKEN_CALENDAR, /^(?:B[12])/i, 0 ], [ TOKEN_ERROR, /^B$/, 0 ], // pattern must not end in a "B" - // [ TOKEN_DATETIME, /^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/, 0 ], [ TOKEN_DATETIME, reDatetime, 0 ], - // [ TOKEN_DURATION, /^(?:\[(h+|m+|s+)\])/i, 1 ], [ TOKEN_DURATION, reDuration, 1 ], + [ TOKEN_AMPM, /^(?:AM\/PM|am\/pm|A\/P)/, 0 ], [ TOKEN_CONDITION, /^\[((?:<[=>]?|>=?|=)\s*(?:-?[.\d]+))\]/, 1 ], [ TOKEN_DBNUM, /^\[(DBNum[0-4]?\d)\]/i, 1 ], [ TOKEN_NATNUM, /^\[(NatNum[0-4]?\d)\]/i, 1 ], [ TOKEN_LOCALE, /^\[\$([^\]]+)\]/, 1 ], - [ TOKEN_COLOR, /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i, 1 ] - ); - if (reColors) { - handlers.push([ TOKEN_COLOR, reColors, 1 ]); - } - if (reColor) { - handlers.push([ TOKEN_COLOR, reColor, 1 ]); - } - handlers.push( + [ TOKEN_COLOR, /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i, 1 ], // conditionally allow these open ended directions? [ TOKEN_MODIFIER, /^\[([^\]]+)\]/, 1 ], - [ TOKEN_AMPM, /^(?:AM\/PM|am\/pm|A\/P)/, 0 ], [ TOKEN_ESCAPED, /^\\(.)/, 1 ], [ TOKEN_STRING, /^"([^"]*?)"/, 1 ], [ TOKEN_SKIP, /^_(\\.|.)/, 1 ], diff --git a/lib/tokenize.ts b/lib/tokenize.ts index 120e8f1..06fbabe 100644 --- a/lib/tokenize.ts +++ b/lib/tokenize.ts @@ -1,5 +1,6 @@ import { TOKEN_GROUP, TOKEN_SCALE, TOKEN_COMMA, TOKEN_CHAR } from './constants.ts'; -import { TOKEN_HANDLERS } from './tokenHandlers.ts'; +import { defaultLocale } from './locale.ts'; +import { getTokenHandlers } from './tokenHandlers.ts'; import type { Token, TokenType } from './types.ts'; const CODE_QMRK = 63; @@ -112,5 +113,5 @@ export function lexer (pattern: string, handlers: [ TokenType, RegExp, number ][ * @returns A list of tokens */ export function tokenize (pattern: string): Token[] { - return lexer(pattern, TOKEN_HANDLERS); + return lexer(pattern, getTokenHandlers(defaultLocale)); } diff --git a/test/delocalize.spec.ts b/test/delocalize.spec.ts index 38e0ba5..9f7e6c1 100644 --- a/test/delocalize.spec.ts +++ b/test/delocalize.spec.ts @@ -185,6 +185,7 @@ describe('delocalize', () => { test('french', () => { const opts = 'fr'; expect(delocalize('AA-MM-JJ HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + expect(delocalize('ooo', opts)).toBe('AAA'); expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); @@ -226,6 +227,8 @@ describe('delocalize', () => { test('italian', () => { const opts = 'it'; expect(delocalize('AA-MM-GG HH:MM:SS', opts)).toBe('YY-MM-DD HH:MM:SS'); + expect(delocalize('ooo', opts)).toBe('AAA'); + expect(delocalize('xxx', opts)).toBe('GGG'); expect(delocalize('#,##0.00', opts)).toBe('#.##0,00'); expect(delocalize('#.##0,00', opts)).toBe('#,##0.00'); From c37052fd8162bc8627239602c126c14008f87551 Mon Sep 17 00:00:00 2001 From: Borgar Date: Sat, 3 Oct 2026 17:09:54 +0000 Subject: [PATCH 3/4] Support converting Excel format IDs to patterns --- lib/getFormatFromId.ts | 187 ++ lib/index.ts | 3 +- lib/locale.ts | 209 +- lib/locales.ts | 257 +- lib/parseValue/parseDateNf.ts | 2 +- lib/parseValue/parseDateXl.ts | 2 +- lib/parseValue/parseValue.ts | 2 +- lib/tokenHandlers.ts | 22 +- test/getFormatFromId.spec.ts | 4216 ++++++++++++++++++++++++++++++++ test/locale.spec.ts | 13 +- test/parseValue-excel.spec.ts | 2 +- test/parseValue-numfmt.spec.ts | 2 +- 12 files changed, 4757 insertions(+), 160 deletions(-) create mode 100644 lib/getFormatFromId.ts create mode 100644 test/getFormatFromId.spec.ts diff --git a/lib/getFormatFromId.ts b/lib/getFormatFromId.ts new file mode 100644 index 0000000..3341203 --- /dev/null +++ b/lib/getFormatFromId.ts @@ -0,0 +1,187 @@ +import { getLocale, type LocaleData, type LocalFormat } from './locale.ts'; + +function getFx (params: LocalFormat, symbol: string) { + if (!symbol) { + return [ '', '' ]; + } + const qt = /[a-z.]/i.test(symbol); + const x = qt ? `"${symbol}"` : symbol; + if (params.currencyPos === 1) { + return [ '', x ]; + } + else if (params.currencyPos === 2) { + return [ x + ' ', '' ]; + } + else if (params.currencyPos === 3) { + return [ '', ' ' + x ]; + } + return [ x, '' ]; +} + +function getNum (params: LocalFormat, color: boolean, frac: boolean, cur = '$') { + const { sign, minus } = params; + const red = color ? '[Red]' : ''; + const dec = frac ? '.00' : ''; + const c = getFx(params, cur); + const s = sign ? [ '', '-' ] : [ '-', '' ]; + return !minus + ? `${c[0]}#,##0${dec}${c[1]}_);${red}(${c[0]}#,##0${dec}${c[1]})` + : `${c[0]}#,##0${dec}${c[1]};${red}${s[0]}${c[0]}${s[1]}#,##0${dec}${c[1]}`; +} + +function getNum2 (params: LocalFormat, frac: boolean, cur = '$') { + const { sign, minus } = params; + const dec = frac ? '.00' : ''; + const c = getFx(params, cur); + if (!minus) { + if (sign) { + return ( + `_ ${c[0]}* #,##0${dec}_)${c[1]}_ ;` + + `_ ${c[0]}* (#,##0${dec})${c[1]}_ ;` + + `_ ${c[0]}* "-"${frac ? '??' : ''}_)${c[1]}_ ;` + + '_ @_ ' + ); + } + return ( + `_(${c[0]}* #,##0${dec}${c[1]}_);` + + `_(${c[0]}* (#,##0${dec}${c[1]});` + + `_(${c[0]}* "-"${frac ? '??' : ''}${c[1]}_);` + + '_(@_)' + ); + } + if (sign) { + return ( + `_ ${c[0]}* #,##0${dec}${c[1]}_ ;` + + `_ ${c[0]}* -#,##0${dec}${c[1]}_ ;` + + `_ ${c[0]}* "-"${frac ? '??' : ''}${c[1]}_ ;` + + '_ @_ ' + ); + } + return ( + `_-${c[0]}* #,##0${dec}${c[1]}_-;` + + `-${c[0]}* #,##0${dec}${c[1]}_-;` + + `_-${c[0]}* "-"${frac ? '??' : ''}${c[1]}_-;` + + '_-@_-' + ); +} + +function getPer (params: LocalFormat, frac: boolean) { + return `0${frac ? '.00' : ''}${params.spacePercent ? ' ' : ''}%`; +} + +function getDate (params: LocalFormat) { + const s = params.dateSep ?? '/'; + const d = params.padDd ? 'dd' : 'd'; + const m = params.padMm ? 'mm' : 'm'; + const y = params.shortYear ? 'yy' : 'yyyy'; + if (params.dateOrder === 2) { + return `${y}${s}${m}${s}${d}`; + } + if (params.dateOrder === 1) { + return `${d}${s}${m}${s}${y}`; + } + return `${m}${s}${d}${s}${y}`; +} + +function getDate2 (params: LocalFormat, dx: boolean, yx: boolean) { + const parts = [ + dx ? (params.padDd ? 'dd' : 'd') : '', + dx ? params.shortDateSep ?? '-' : '', + 'mmm', + yx ? (params.shortDateSep === '. ' ? ' ' : params.shortDateSep) ?? '-' : '', + yx ? 'yy' : '' + ]; + return parts.filter(Boolean).join(''); +} + +function getTime (params: LocalFormat, sec = false, ampm = false) { + const am = ampm ? ' AM/PM' : ''; + const s = params.timeSep ?? ':'; + return `${params.padHh ? 'hh' : 'h'}${s}mm${sec ? s + 'ss' : ''}${am}`; +} + +function getTime2 (params: LocalFormat, sec = false, ampm = false) { + const am = ampm ? ' AM/PM' : ''; + const s = params.timeSep ?? ':'; + return `${params.padHhAlt ? 'hh' : 'h'}${s}mm${sec ? s + 'ss' : ''}${am}`; +} + +/** + * Return the correct format for a given built-in ID in a locale. + * + * @param fmtId The format ID + * @param l10n The locale to use as either a BCP 47 string tag of the locale, an Excel locale code, or a locale data record. + * @returns The format pattern + */ +export function getFormatFromId (fmtId: number, l10n?: LocaleData | string | number) { + if (typeof l10n === 'string' || typeof l10n === 'number') { + l10n = getLocale(l10n); + } + const currency = l10n?.currency || '$'; + const params = l10n?.format || {}; + + // ID numbers go: 0,1,2,3...56,57,58,1,2,3,4 + fmtId = fmtId > 0 ? 1 + ((fmtId - 1) % 58) : 0; + + switch (fmtId) { + case 0: return 'General'; // General + case 1: return '0'; // NoComFixed0 + case 2: return '0.00'; // NoComFixed + case 3: return '#,##0'; // Fixed0 + case 4: return '#,##0.00'; // Fixed + + case 5: return getNum(params, false, false, currency); // Currency + case 6: return getNum(params, true, false, currency); // CoCurrency + case 7: return getNum(params, false, true, currency); // CurrencyDec + case 8: return getNum(params, true, true, currency); // CoCurrencyDec + + case 9: return getPer(params, false); // Pct0 + case 10: return getPer(params, true); // Pct + + case 11: return '0.00E+00'; // Exp + + case 12: return '# ?/?'; // Fract + case 13: return '# ??/??'; // FractBond + + case 14: return getDate(params); // MMDDYY + case 15: return getDate2(params, true, true); // DDMMMYY + case 16: return getDate2(params, true, false); // DDMMM + case 17: return getDate2(params, false, true); // MMMYY + + case 18: return getTime2(params, false, true); // HHMMAP + case 19: return getTime2(params, true, true); // HHMMSSAP + case 20: return getTime(params); // HHMM + case 21: return getTime(params, true); // HHMMSS + + case 22: return getDate(params) + ' ' + getTime(params); // MDYHMS + + case 27: case 28: case 29: case 30: case 31: + return getDate(params); + + case 32: case 33: case 34: case 35: + return getTime(params, true); + + case 36: return getDate(params); + + case 37: return getNum(params, false, false, ''); // Currency2 + case 38: return getNum(params, true, false, ''); // CoCurrency2 + case 39: return getNum(params, false, true, ''); // CurrencyDec2 + case 40: return getNum(params, true, true, ''); // CoCurrencyDec2 + + case 41: return getNum2(params, false, ''); // Acct + case 42: return getNum2(params, false, currency); // AcctCur + case 43: return getNum2(params, true, ''); // AcctDec + case 44: return getNum2(params, true, currency); // AcctDecCur + + case 45: return `mm${params.timeSep ?? ':'}ss`; // MMSS + case 46: return `[h]${params.timeSep ?? ':'}mm${params.timeSep ?? ':'}ss`; // AbsHMMSS + case 47: return `mm${params.timeSep ?? ':'}ss.0`; // SS0 + case 48: return '##0.0E+0'; // Eng + + case 49: return '@'; // Text + + case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: + return getDate(params); + } + return 'General'; +} diff --git a/lib/index.ts b/lib/index.ts index 74e89b3..86fe189 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -41,7 +41,7 @@ export { import { dateToSerial as handleDates } from './serialDate.ts'; export { dateToSerial, dateFromSerial } from './serialDate.ts'; -export type { LocaleData, LocaleToken, MonthNames, DayNames } from './locale.ts'; +export type { LocaleData, LocalFormat, LocaleToken, MonthNames, DayNames } from './locale.ts'; export type { ParseDataBool, ParseDataNum } from './parseValue/types.ts'; export { parseNumber } from './parseValue/parseNumber.ts'; @@ -57,6 +57,7 @@ import type { FormatDateInfo, FormatInfo, PatternParseData } from './types.ts'; import { createPartition } from './createPartition.ts'; export { tokenize } from './tokenize.ts'; +export { getFormatFromId } from './getFormatFromId.ts'; type CacheData = PatternParseData & { dateInfo?: FormatDateInfo, info?: FormatInfo }; const _parseDataCache = new Map(); diff --git a/lib/locale.ts b/lib/locale.ts index f496b55..8d85da2 100644 --- a/lib/locale.ts +++ b/lib/locale.ts @@ -11,11 +11,92 @@ const locales: Record = {}; export type MonthNames = [ string, string, string, string, string, string, string, string, string, string, string, string ]; + /** * A list of the names of the days of the week, starting with Sunday. */ export type DayNames = [ string, string, string, string, string, string, string ]; +/** + * An object of instructive properties on how default formats should be constructed. + */ +export type LocalFormat = { + /** + * Use a minus for negative values (`-#,##0`) over putting parenthesis around the value (`(#,##0)`). + * @default false + */ + minus?: boolean; + /** + * Sign location: + * - `false` or `undefined`: after currency (`$-10`) + * - `true`: before currency (`-$10`) + * @default false + */ + sign?: boolean; + /** + * Date order: + * - 0: mm/dd/yy + * - 1: dd/mm/yy + * - 2: yy/mm/dd + * @default 0 + */ + dateOrder?: 0 | 1 | 2; + /** + * Pad date part (`dd`) or not (`d`). + * @default false + */ + padDd?: boolean; + /** + * Pad hours part (`hh`) or not (`h`). + * @default false + */ + padHh?: boolean; + /** + * Pad hours part (`hh`) or not (`h`) in alternate time format. + * @default false + */ + padHhAlt?: boolean; + /** + * Pad month part (`mm`) or not (`m`). + * @default false + */ + padMm?: boolean; + /** + * Use 2 digit year rather than 4 digit in dates. + * @default false + */ + shortYear?: boolean; + /** + * Date separator character (default: `/`) + * @default "/" + */ + dateSep?: string; + /** + * Short date separator character (default: `-`) + * @default "-" + */ + shortDateSep?: string; + /** + * Time separator character (default: `:`) + * @default ":" + */ + timeSep?: string; + /** + * Print a space before a percent sign. + * @default false + */ + spacePercent?: boolean; + /** + * Currency symbol location: + * - 0: prefix (`$0`) + * - 1: postfix (`0$`) + * - 2: prefix spaced (`$ 0`) + * - 3: postfix spaced (`0 $`) + * @default 0 + */ + currencyPos?: 0 | 1 | 2 | 3; +}; + /** * An object of properties used by a formatter when printing a number in a certain locale. */ @@ -104,53 +185,85 @@ export type LocaleData = { * How the "Color" keyword is written in the language. * @default "Color" */ - color?: string, + color?: string; /** * How the "General" keyword is written in the language. * @default "General" */ - general?: string, + general?: string; /** * A map for the color keywords in the language, into US English. * The keys should be the lower-case localized versions (`bianco`) and the values * should be title-cased English equivalents (`Black`). * @default {black:"Black", white:"White", red:"Red", green:"Green", blue:"Blue", yellow:"Yellow", magenta:"Magenta", cyan:"Cyan"} */ - colors?: Record, + colors?: Record; /** * Operator symbol map.This is a record of characters, one for each operator. The value should * be single character lower case strings. Keys are as follows: * - * - `dy`: Year of a date, defaults to `y`. - * - `dm`: Month of a date, defaults to `m`. - * - `dd`: Day of a date, defaults to `d`. - * - `th`: Hours of time, defaults to `h`. - * - `tm`: Minutes of time, defaults to `m`. - * - `ts`: Seconds of time, defaults to `s`. - * - `wd`: Weekday (alt.), defaults to `a`. - * - `en`: Era name, defaults to `g`. + * | property | description | default + * |-- |-- |-- + * | `dy` | Year of a date | `y` | + * | `dm` | Month of a date | `m` | + * | `dd` | Day of a date | `d` | + * | `th` | Hours of time | `h` | + * | `tm` | Minutes of time | `m` | + * | `ts` | Seconds of time | `s` | + * | `wd` | Weekday (alt.) | `a` | + * | `en` | Era name | `g` | */ opcodes?: { + /** + * Year of a date. + * @default "y". + */ dy?: string, + /** + * Month of a date. + * @default "m". + */ dm?: string, + /** + * Day of a date. + * @default "d". + */ dd?: string, + /** + * Hours of time. + * @default "h". + */ th?: string, + /** + * Minutes of time. + * @default "m". + */ tm?: string, + /** + * Seconds of time. + * @default "s". + */ ts?: string, + /** + * Weekday (alt.). + * @default "a". + */ wd?: string, + /** + * Era name. + * @default "g". + */ en?: string, - }, + }; /** * The currency symbol used by the Locale. * @default "$" */ - currency: string, + currency: string; /** - * Is the prefered date format month first (12/31/2025) or day first (31/12/2025). - * @default false + * Instructive properties on how formats should be constructed. */ - preferMDY: boolean; - // dateOrder?: number, + format?: LocalFormat; }; /** @@ -200,10 +313,14 @@ const baseLocaleData: LocaleData = { magenta: 'Magenta', cyan: 'Cyan' }, - // dateOrder: 0, - preferMDY: false - // lcid: -1, - // code: '', + format: { + minus: true, + dateOrder: 1, + currencyPos: 2, + padMm: true, + padDd: true, + padHh: true + } }; /** @@ -266,50 +383,20 @@ export function getLocale (locale: string | number): LocaleData | undefined { // creates a new locale options object export function createLocale (data: Partial): LocaleData { - return Object.assign({}, baseLocaleData, data); + return { + ...baseLocaleData, + ...data, + opcodes: { ...baseLocaleData.opcodes, ...data.opcodes }, + format: { ...baseLocaleData.format, ...data.format } + }; } -// XXX: FIXME --- needs more docs /** * Register locale data for a language to use when formatting. * * Any partial set of properties may be provided to have the defaults used where properties are missing. * * @param localeSettings - A collection of settings for a locale. - * @param [localeSettings.group="\u00a0"] - * Symbol used as a grouping separator (`1,000,000` uses `,`) - * @param [localeSettings.decimal="."] - * Symbol used to separate integers from fractions (usually `.`) - * @param [localeSettings.positive="+"] - * Symbol used to indicate positive numbers (usually `+`) - * @param [localeSettings.negative="-"] - * Symbol used to indicate positive numbers (usually `-`) - * @param [localeSettings.percent="%"] - * Symbol used to indicate a percentage (usually `%`) - * @param [localeSettings.exponent="E"] - * Symbol used to indicate an exponent (usually `E`) - * @param [localeSettings.nan="NaN"] - * Symbol used to indicate NaN values (`NaN`) - * @param [localeSettings.infinity="∞"] - * Symbol used to indicate infinite values (`∞`) - * @param [localeSettings.ampm=["AM","PM"]] - * How AM and PM should be presented. - * @param [localeSettings.mmmm6=["Muharram", "Safar", "Rabiʻ I", "Rabiʻ II", "Jumada I", "Jumada II", "Rajab", "Shaʻban", "Ramadan", "Shawwal", "Dhuʻl-Qiʻdah", "Dhuʻl-Hijjah"]] - * Long month names for the Islamic calendar (e.g. `Rajab`) - * @param [localeSettings.mmm6=["Muh.", "Saf.", "Rab. I", "Rab. II", "Jum. I", "Jum. II", "Raj.", "Sha.", "Ram.", "Shaw.", "Dhuʻl-Q.", "Dhuʻl-H."]] - * Short month names for the Islamic calendar (e.g. `Raj.`) - * @param [localeSettings.mmmm=["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]] - * Long month names for the Gregorian calendar (e.g. `November`) - * @param [localeSettings.mmm=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]] - * Short month names for the Gregorian calendar (e.g. `Nov`) - * @param [localeSettings.dddd=["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]] - * Long day names (e.g. `Wednesday`) - * @param [localeSettings.ddd=["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]] - * Shortened day names (e.g. `Wed`) - * @param [localeSettings.bool=["TRUE", "FALSE"]] - * How TRUE and FALSE should be presented. - * @param [localeSettings.preferMDY=false] - * Is the prefered date format month first (12/31/2025) or day first (31/12/2025) * @param l4e - A string BCP 47 tag of the locale. * @returns A full collection of settings for a locale */ @@ -322,12 +409,9 @@ export function addLocale (localeSettings: Partial, l4e: string | Lo if (c.language !== c.lang && !locales[c.language]) { locales[c.language] = createLocale(localeSettings); } - s.add(locales[c.lang].decimal); return locales[c.lang]; } -const s = new Set(); - /** * Get a list of locales that are registered with the formatter. * @returns A list of locale tags @@ -336,7 +420,10 @@ export function listLocales () { return Object.keys(locales); } -export const defaultLocale: LocaleData & { isDefault?: boolean } = createLocale({ group: ',', preferMDY: true }); +export const defaultLocale: LocaleData & { isDefault?: boolean } = createLocale({ + group: ',', + format: { dateOrder: 1 } +}); defaultLocale.isDefault = true; initLocales(); diff --git a/lib/locales.ts b/lib/locales.ts index 9be00f5..7ddaf31 100644 --- a/lib/locales.ts +++ b/lib/locales.ts @@ -1,4 +1,4 @@ -import { addLocale, type DayNames, type LocaleData, type MonthNames } from './locale.ts'; +import { addLocale, type DayNames, type LocaleData, type LocalFormat, type MonthNames } from './locale.ts'; /** * Split a semicolon delimited string and replace instances of characters @@ -53,6 +53,54 @@ const xm = (o: Partial & Pick, ml: numb return o; }; +type CompressedFormat = { + p?: 0 | 1; // parens around negatives + s?: 0 | 1; // sign location: false=after currency, true=before currency + o?: 0 | 1 | 2; // date order + d?: 0 | 1; // pad date + h?: 0 | 1; // pad hours + i?: 0 | 1; // pad hours, alt + m?: 0 | 1; // pad month + y?: 0 | 1; // short year + k?: string; // date separator + l?: string; // date-short separator + b?: string; // time separator + c?: 0 | 1; // space around percent sign + f?: 0 | 1 | 2 | 3; // currency symbol location +}; + +/** + * Expand CompressedFormat to LocalFormat. + * Note that the defaults are not the same as in LocalFormat. + * This is done to save bytes across the wire. + * @internal + * @param p Compressed format params + * @returns Expanded format params + */ +const xf = (p: CompressedFormat): Required => { + return { + minus: !p.p, + sign: !!p.s, + dateOrder: p.o ?? 1, + currencyPos: p.f ?? 3, + padMm: p.m == null ? true : !!p.m, + padDd: p.d == null ? true : !!p.d, + padHh: p.h == null ? true : !!p.h, + padHhAlt: !!p.i, + dateSep: p.k ?? '/', + shortDateSep: p.l ?? '-', + timeSep: p.b ?? ':', + shortYear: !!p.y, + spacePercent: !!p.c + }; +}; + +const fp1: CompressedFormat = { k: '.', l: '.' }; +const fp2: CompressedFormat = { d: 0, h: 0, m: 0, k: '.', l: '.' }; +const fp3: CompressedFormat = { d: 1, y: 1, f: 0, o: 1, k: '-', b: ':', s: 1 }; +const fp4: CompressedFormat = { ...fp3, y: 0 }; +const fp5: CompressedFormat = { h: 0, d: 0, f: 0, m: 0, s: 1 }; + export function initLocales () { const _zhM4 = _M('一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月'); const _zhCl = { @@ -84,7 +132,8 @@ export function initLocales () { 蓝绿色: 'Cyan' }, general: 'G/通用格式', - currency: '¥' + currency: '¥', + format: xf({ h: 0, d: 0, f: 0, m: 0, o: 2, s: 1 }) }, 'zh-CN'); addLocale({ group: ',', @@ -97,7 +146,8 @@ export function initLocales () { color: '色彩', colors: _zhCl, general: 'G/通用格式', - currency: 'NT$' + currency: 'NT$', + format: xf({ d: 0, f: 0, o: 2, m: 0, i: 1 }) }, 'zh-TW'); addLocale({ group: ',', @@ -108,7 +158,8 @@ export function initLocales () { ddd: _W('週日;週一;週二;週三;週四;週五;週六'), color: '色彩', colors: _zhCl, - currency: 'HK$' + currency: 'HK$', + format: xf({ h: 0, d: 0, f: 0, m: 0, p: 1 }) }, 'zh-HK'); addLocale({ @@ -130,7 +181,8 @@ export function initLocales () { 黄: 'Yellow', 紫: 'Magenta', 水: 'Cyan' - } + }, + format: xf({ h: 0, f: 0, o: 2, d: 1 }) }, 'ja'); addLocale({ @@ -152,7 +204,8 @@ export function initLocales () { 녹청: 'Cyan' }, general: 'G/표준', - currency: '₩' + currency: '₩', + format: xf({ h: 0, f: 0, o: 2, k: '-' }) }, 'ko'); addLocale({ @@ -173,7 +226,8 @@ export function initLocales () { ม่วงมาเจนต้า: 'Magenta', ฟ้า: 'Cyan' }, - currency: '฿' + currency: '฿', + format: xf({ h: 0, d: 0, f: 0, m: 0, o: 1 }) }, 'th'); addLocale(xm({ @@ -196,7 +250,8 @@ export function initLocales () { }, general: 'Všeobecný', opcodes: { dy: 'r' }, - currency: 'Kč' + currency: 'Kč', + format: xf({ h: 0, k: '.', l: '.' }) }, -1, 2), 'cs'); addLocale(xm({ @@ -218,7 +273,8 @@ export function initLocales () { }, general: 'Standard', opcodes: { dy: 'å', th: 't' }, - currency: 'kr.' + currency: 'kr.', + format: xf({ k: '-' }) }, 3, 2), 'da'); addLocale(xm({ @@ -242,20 +298,22 @@ export function initLocales () { }, general: 'Standaard', opcodes: { dy: 'j', th: 'u' }, - currency: '€' + currency: '€', + format: xf({ d: 0, f: 2, m: 0, k: '-', s: 1 }) }, -1, 2), 'nl'); - addLocale({ group: ',', preferMDY: true }, 'en'); - addLocale({ group: ',', preferMDY: true }, 'en-US'); - addLocale({ group: ',' }, 'en-CA'); - addLocale({ group: ',', color: 'Colour', ampm: [ 'AM', 'PM' ] }, 'en-AU'); - addLocale({ group: ',', color: 'Colour', ampm: [ 'AM', 'PM' ], currency: '£' }, 'en-GB'); + addLocale({ group: ',', format: xf({ h: 0, d: 0, f: 0, m: 0, o: 0, p: 1 }) }, 'en'); + addLocale({ group: ',', format: xf({ h: 0, d: 0, f: 0, m: 0, o: 0, p: 1 }) }, 'en-US'); + addLocale({ group: ',', format: xf({ h: 0, f: 0, o: 2, p: 0, k: '-' }) }, 'en-CA'); + addLocale({ group: ',', color: 'Colour', ampm: [ 'AM', 'PM' ], format: xf({ h: 0, d: 0, f: 0, p: 0 }) }, 'en-AU'); + addLocale({ group: ',', color: 'Colour', ampm: [ 'AM', 'PM' ], currency: '£', format: xf({ f: 0, p: 0 }) }, 'en-GB'); addLocale({ group: ',', mmm: _M('Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec'), color: 'Colour', ampm: [ 'am', 'pm' ], - currency: '€' + currency: '€', + format: xf({ f: 0, p: 0 }) }, 'en-IE'); addLocale(xm({ @@ -279,7 +337,8 @@ export function initLocales () { }, general: 'Yleinen', currency: '€', - opcodes: { dy: 'v', dm: 'k', dd: 'p', th: 't' } + opcodes: { dy: 'v', dm: 'k', dd: 'p', th: 't' }, + format: xf({ h: 0, d: 0, p: 0, k: '.', l: '.', m: 0, c: 1 }) }, -1, 2), 'fi'); const _fr = xm({ @@ -304,9 +363,9 @@ export function initLocales () { opcodes: { dy: 'a', dd: 'j', wd: 'o' }, general: 'Standard' }, -1, -13); - addLocale({ ..._fr, currency: '€' }, 'fr'); - addLocale({ ..._fr, ampm: [ 'a.m.', 'p.m.' ] }, 'fr-CA'); - addLocale({ group: "'", decimal: '.', ..._fr, currency: 'CHF' }, 'fr-CH'); + addLocale({ ..._fr, currency: '€', format: xf({}) }, 'fr'); + addLocale({ ..._fr, ampm: [ 'a.m.', 'p.m.' ], format: xf({ p: 1, o: 2, d: 1, k: '-', l: '-', s: 1 }) }, 'fr-CA'); + addLocale({ group: "'", decimal: '.', ..._fr, currency: 'CHF', format: xf({ o: 1, d: 1, k: '.', l: '.' }) }, 'fr-CH'); const _de = xm({ mmmm: _M('Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember'), @@ -327,8 +386,8 @@ export function initLocales () { opcodes: { dy: 'j', dd: 't' }, general: 'Standard' }, -1, 2); - addLocale({ group: '.', decimal: ',', ..._de, currency: '€' }, 'de'); - addLocale({ group: '’', decimal: '.', ..._de, currency: 'CHF', mmm: _M('Jan;Feb;Mär;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez') }, 'de-CH'); + addLocale({ group: '.', decimal: ',', ..._de, currency: '€', format: xf({ k: '.', l: '. ' }) }, 'de'); + addLocale({ group: '’', decimal: '.', ..._de, currency: 'CHF', mmm: _M('Jan;Feb;Mär;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez'), format: xf({ o: 1, d: 1, k: '.', f: 2, s: 1, l: '. ' }) }, 'de-CH'); addLocale(xm({ group: '.', @@ -351,7 +410,8 @@ export function initLocales () { general: 'Γενικός τύπος', color: 'Χρώμα', opcodes: { dy: 'ε', dm: 'μ', dd: 'η', th: 'ω', tm: 'λ', ts: 'δ' }, - currency: '€' + currency: '€', + format: xf({ h: 0, d: 0, m: 0 }) }, -1, 3), 'el'); addLocale({ @@ -375,7 +435,8 @@ export function initLocales () { bíbor: 'Magenta', ciánkék: 'Cyan' }, - color: 'Szín' + color: 'Szín', + format: xf({ h: 0, o: 2, k: '.', l: '.', d: 1 }) }, 'hu'); addLocale(xm({ @@ -384,7 +445,8 @@ export function initLocales () { ampm: _B('f.h.;e.h.'), mmmm: _M('janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember'), dddd: _W('sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~', 'dagur'), - currency: 'kr.' + currency: 'kr.', + format: xf({ d: 0, m: 0, k: '.', l: '.' }) }, 3, 3), 'is'); addLocale(xm({ @@ -405,7 +467,8 @@ export function initLocales () { magenta: 'Magenta', sian: 'Cyan' }, - currency: 'Rp' + currency: 'Rp', + format: xf({ f: 0, b: '.' }) }, 3, 3), 'id'); const _it = xm({ @@ -427,8 +490,8 @@ export function initLocales () { }, opcodes: { dy: 'a', dd: 'g', wd: 'o', en: 'x' } }, 3, 3); - addLocale({ group: '.', decimal: ',', ..._it, currency: '€' }, 'it'); - addLocale({ group: '’', decimal: '.', ..._it, currency: 'CHF' }, 'it-CH'); + addLocale({ group: '.', decimal: ',', ..._it, currency: '€', format: xf({}) }, 'it'); + addLocale({ group: '’', decimal: '.', ..._it, currency: 'CHF', format: xf({ o: 1, d: 1, k: '.', l: '.', f: 2, s: 1 }) }, 'it-CH'); const _no = { decimal: ',', @@ -452,8 +515,8 @@ export function initLocales () { opcodes: { dy: 'å', th: 't' }, currency: 'kr' }; - addLocale(xm({ ..._no }, -1, 3), 'nb'); - addLocale(xm({ ..._no }, -1, 3), 'no'); + addLocale(xm({ ..._no, format: xf({ f: 2, c: 1, k: '.', l: '.', s: 1 }) }, -1, 3), 'nb'); + addLocale(xm({ ..._no, format: xf({ f: 2, c: 1, k: '.', l: '.', s: 1 }) }, -1, 3), 'no'); addLocale(xm({ decimal: ',', @@ -474,7 +537,8 @@ export function initLocales () { }, general: 'Standardowy', opcodes: { dy: 'r', th: 'g' }, - currency: 'zł' + currency: 'zł', + format: xf({ d: 0, k: '.', l: '.' }) }, 3, -1), 'pl'); const _pt = { @@ -500,7 +564,8 @@ export function initLocales () { turquesa: 'Cyan', // mac ciano: 'Cyan' // pc }, - currency: '€' + currency: '€', + format: xf({ l: '/' }) }, 'pt'); addLocale({ ...xm(_pt, 3, 3), @@ -516,7 +581,8 @@ export function initLocales () { magenta: 'Magenta', ciano: 'Cyan' }, - currency: 'R$' + currency: 'R$', + format: xf({ f: 2, l: '/' }) }, 'pt-BR'); addLocale({ @@ -543,7 +609,8 @@ export function initLocales () { пурпурный: 'Magenta', // win голубой: 'Cyan' }, - currency: '₽' + currency: '₽', + format: xf({ h: 0, k: '.', l: '.' }) }, 'ru'); addLocale(xm({ @@ -562,7 +629,8 @@ export function initLocales () { purpurová: 'Magenta', azúrová: 'Cyan' }, - currency: '€' + currency: '€', + format: xf(fp2) }, 3, 2), 'sk'); const _es = { @@ -588,13 +656,13 @@ export function initLocales () { }; const _esM3 = _M('ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic'); const _esM3s = _M('ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic'); - addLocale({ ..._es, ddd: _W('do;lu;ma;mi;ju;vi;sá'), general: 'Estándar', opcodes: { dy: 'a', wd: 'o' }, currency: '€' }, 'es'); - addLocale({ ..._es, mmm: _esM3s }, 'es-AR'); - addLocale({ ..._es, mmm: _esM3s, currency: 'Bs' }, 'es-BO'); - addLocale({ ..._es, mmm: _esM3s }, 'es-CL'); - addLocale({ ..._es, mmm: _esM3 }, 'es-CO'); - addLocale({ ..._es, mmm: _esM3s }, 'es-EC'); - addLocale({ ..._es, mmm: _esM3s, currency: '₲' }, 'es-PY'); + addLocale({ ..._es, ddd: _W('do;lu;ma;mi;ju;vi;sá'), general: 'Estándar', opcodes: { dy: 'a', wd: 'o' }, currency: '€', format: xf({ h: 0, d: 1 }) }, 'es'); + addLocale({ ..._es, mmm: _esM3s, format: xf({ d: 0, f: 2, m: 0 }) }, 'es-AR'); + addLocale({ ..._es, mmm: _esM3s, currency: 'Bs', format: xf({ d: 0, f: 0, m: 0 }) }, 'es-BO'); + addLocale({ ..._es, mmm: _esM3s, format: xf({ h: 0, f: 0, s: 1, k: '-' }) }, 'es-CL'); + addLocale({ ..._es, mmm: _esM3, format: xf({ h: 0, d: 0, f: 2 }) }, 'es-CO'); + addLocale({ ..._es, mmm: _esM3s, format: xf(fp5) }, 'es-EC'); + addLocale({ ..._es, mmm: _esM3s, currency: '₲', format: xf({ d: 0, f: 2, s: 1, m: 0 }) }, 'es-PY'); addLocale({ ..._es, group: ',', @@ -602,17 +670,20 @@ export function initLocales () { mmm: _esM3, ampm: _B('a.m.;p.m.'), opcodes: { dy: 'a', wd: 'o' }, - general: 'Estándar' + general: 'Estándar', + format: xf({ f: 0, i: 1 }) }, 'es-MX'); addLocale({ ..._es, mmmm: _M('Enero;Febrero;Marzo;Abril;Mayo;Junio;Julio;Agosto;Setiembre;Octubre;Noviembre;Diciembre'), - mmm: _M('Ene;Feb;Mar;Abr;May;Jun;Jul;Ago;set;Oct;Nov;Dic') + mmm: _M('Ene;Feb;Mar;Abr;May;Jun;Jul;Ago;set;Oct;Nov;Dic'), + format: xf({ d: 0, f: 2, h: 0, m: 0 }) }, 'es-UY'); addLocale({ ..._es, mmm: _esM3s, - currency: 'Bs.S' + currency: 'Bs.S', + format: xf(fp5) }, 'es-VE'); addLocale(xm({ @@ -634,7 +705,8 @@ export function initLocales () { magenta: 'Magenta', cyanblå: 'Cyan' }, - currency: 'kr' + currency: 'kr', + format: xf({ o: 2, k: '-' }) }, 3, 3), 'sv'); addLocale(xm({ @@ -659,7 +731,8 @@ export function initLocales () { }, opcodes: { dm: 'a', dd: 'g', th: 's', tm: 'd', ts: 'n' }, general: 'Genel', - currency: '₺' + currency: '₺', + format: xf({ d: 0, f: 0, k: '.', l: '.' }) }, 3, -1), 'tr'); addLocale({ @@ -669,7 +742,8 @@ export function initLocales () { mmm: _M('Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag'), dddd: _W('Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn'), ddd: _W('Sul;Llun;Maw;Mer;Iau;Gwe;Sad'), - currency: '£' + currency: '£', + format: xf({ f: 0, p: 0 }) }, 'cy'); addLocale({ @@ -679,7 +753,8 @@ export function initLocales () { mmm: _M('yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek'), dddd: _W('bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə'), ddd: _W('B;B.E;Ç.A;Ç;C.A;C;Ş'), - currency: '₼' + currency: '₼', + format: xf(fp1) }, 'az'); addLocale(xm({ @@ -688,7 +763,8 @@ export function initLocales () { mmm: _M('студз;лют;сак;крас;май;чэрв;ліп;жн;вер;кастр;ліст;снеж'), dddd: _W('нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота'), ddd: _W('нд;пн;аўт;ср;чц;пт;сб'), - currency: 'Br' + currency: 'Br', + format: xf({ y: 1, k: '.', l: '.' }) }, 3, -1), 'be'); addLocale({ @@ -698,8 +774,9 @@ export function initLocales () { mmm: _M('яну;фев;мар;апр;май;юни;юли;авг;сеп;окт;ное;дек'), dddd: _W('неделя;понеделник;вторник;сряда;четвъртък;петък;събота'), ddd: _W('нед;пон;вт;ср;четв;пет;съб'), - currency: 'лв.' + currency: 'лв.', // bool: _B('ИСТИНА;ЛОЖЬ'), + format: xf(fp2) }, 'bg'); addLocale({ @@ -712,7 +789,8 @@ export function initLocales () { general: 'Estándar', opcodes: { dy: 'a', wd: 'o' }, ampm: _B('a.\u00a0m.;p.\u00a0m.'), - currency: '€' + currency: '€', + format: xf({ d: 0, o: 1, h: 0, m: 0 }) }, 'ca'); addLocale(xm({ @@ -720,7 +798,8 @@ export function initLocales () { decimal: '.', mmmm: _M('Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre'), dddd: _W('Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado'), - currency: '₱' + currency: '₱', + format: xf({ h: 0, d: 0, f: 0, m: 0, o: 0 }) }, 3, 3), 'fil'); addLocale({ @@ -731,7 +810,8 @@ export function initLocales () { mmm: _M('જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગ;સપ્ટે;ઑક્ટો;નવે;ડિસે'), dddd: _W('રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~', 'વાર'), ddd: _W('રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ'), - currency: '₹' + currency: '₹', + format: xf(fp3) }, 'gu'); addLocale({ @@ -755,7 +835,8 @@ export function initLocales () { 'אדום ארגמן': 'Magenta', 'תכלת': 'Cyan' }, - currency: '₪' + currency: '₪', + format: xf({ f: 2, s: 1 }) }, 'he'); addLocale(xm({ @@ -764,7 +845,8 @@ export function initLocales () { mmmm: _M('siječanj;veljača;ožujak;travanj;svibanj;lipanj;srpanj;kolovoz;rujan;listopad;studeni;prosinac'), mmm: _M('sij;vlj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro'), dddd: _W('nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota'), - currency: '€' + currency: '€', + format: xf(fp2) }, -1, 3), 'hr'); addLocale({ @@ -773,7 +855,8 @@ export function initLocales () { mmm: _M('Հնվ;Փտվ;Մրտ;Ապր;Մյս;Հնս;Հլս;Օգս;Սպտ;Հկտ;Նյմ;Դկտ'), dddd: _W('Կիրակի;Երկուշաբթի;Երեքշաբթի;Չորեքշաբթի;Հինգշաբթի;Ուրբաթ;Շաբաթ'), ddd: _W('Կիր;Երկ;Երք;Չրք;Հնգ;Ուր;Շբթ'), - currency: '֏' + currency: '֏', + format: xf(fp1) }, 'hy'); addLocale(xm({ @@ -781,7 +864,8 @@ export function initLocales () { mmmm: _M('იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი'), dddd: _W('კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი'), ddd: _W('კვ;ორშ;სამშ;ოთხშ;ხუთშ;პარ;შაბ'), - currency: '₾' + currency: '₾', + format: xf(fp1) }, 3, -1), 'ka'); addLocale(xm({ @@ -792,7 +876,8 @@ export function initLocales () { ddd: _W('жек;дүй;сей;сәр;бей;жұм;сен'), opcodes: { dy: 'г', dm: 'м', dd: 'д', th: 'ч', tm: 'м', ts: 'с' }, currency: '₸', - general: 'Основной' + general: 'Основной', + format: xf(fp1) }, -1, -1), 'kk'); addLocale({ @@ -802,7 +887,8 @@ export function initLocales () { dddd: _W('ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~', 'ವಾರ'), ddd: _W('ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ'), ampm: _B('ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ'), - currency: '₹' + currency: '₹', + format: xf(fp3) }, 'kn'); addLocale({ @@ -812,7 +898,8 @@ export function initLocales () { dddd: _W('sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis'), ddd: _W('sk;pr;an;tr;kt;pn;št'), ampm: _B('priešpiet;popiet'), - currency: '€' + currency: '€', + format: xf({ o: 2, k: '-' }) }, 'lt'); addLocale({ @@ -822,7 +909,8 @@ export function initLocales () { dddd: _W('svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena'), ddd: _W('Svētd;Pirmd;Otrd;Trešd;Ceturtd;Piektd;Sestd'), ampm: _B('priekšp.;pēcp.'), - currency: '€' + currency: '€', + format: xf(fp1) }, 'lv'); addLocale({ @@ -832,7 +920,8 @@ export function initLocales () { mmm: _M('ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം'), dddd: _W('ഞായറാഴ്‌ച;തിങ്കളാഴ്‌ച;ചൊവ്വാഴ്ച;ബുധനാഴ്‌ച;വ്യാഴാഴ്‌ച;വെള്ളിയാഴ്‌ച;ശനിയാഴ്‌ച'), ddd: _W('ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി'), - currency: '₹' + currency: '₹', + format: xf({ d: 0, m: 0, h: 0, y: 0, f: 0, o: 1, k: '/', b: ':', s: 0 }) }, 'ml'); addLocale({ @@ -843,7 +932,8 @@ export function initLocales () { dddd: _W('ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба'), ddd: _W('Ня;Да;Мя;Лха;Пү;Ба;Бя'), ampm: _B('ү.ө.;ү.х.'), - currency: '₮' + currency: '₮', + format: xf({ o: 2, f: 2, k: '.', l: '.' }) }, 'mn'); addLocale({ @@ -854,7 +944,8 @@ export function initLocales () { mmm: _M('जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें'), dddd: _W('रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार'), ddd: _W('रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि'), - currency: '₹' + currency: '₹', + format: xf(fp4) }, 'mr'); addLocale(xm({ @@ -864,7 +955,8 @@ export function initLocales () { mmm: _M('ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ'), dddd: _W('တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ'), ampm: _B('နံနက်;ညနေ'), - currency: 'K' + currency: 'K', + format: xf({ h: 0, d: 0, m: 0 }) }, -1, 0), 'my'); addLocale(xm({ @@ -874,7 +966,8 @@ export function initLocales () { dddd: _W('ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ'), ddd: _W('ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁਕਰ;ਸ਼ਨਿੱਚਰ'), ampm: [ 'ਸਵੇਰ', 'ਸ਼ਾਮ' ], - currency: '₹' + currency: '₹', + format: xf({ d: 1, i: 1, y: 1, f: 2, o: 1, k: '-', b: ':', s: 1 }) }), 'pa'); addLocale({ @@ -885,7 +978,8 @@ export function initLocales () { dddd: _W('duminică;luni;marți;miercuri;joi;vineri;sâmbătă'), ddd: _W('dum;lun;mar;mie;joi;vin;sâm'), ampm: _B('a.m.;p.m.'), - currency: 'lei' + currency: 'lei', + format: xf(fp1) }, 'ro'); addLocale(xm({ @@ -894,7 +988,8 @@ export function initLocales () { mmmm: _M('januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december'), dddd: _W('nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota'), ampm: _B('dop.;pop.'), - currency: '€' + currency: '€', + format: xf({ d: 0, k: '.', l: '.' }) }, 3, 3), 'sl'); addLocale(xm({ @@ -902,7 +997,8 @@ export function initLocales () { decimal: ',', mmmm: _M('januar;februar;mart;april;maj;jun;jul;avgust;septembar;oktobar;novembar;decembar'), dddd: _W('nedelja;ponedeljak;utorak;sreda;četvrtak;petak;subota'), - currency: 'RSD' + currency: 'RSD', + format: xf({ d: 0, m: 0, k: '.', l: '.' }) }, 3, 3), 'sr'); addLocale(xm({ @@ -911,7 +1007,8 @@ export function initLocales () { ampm: [ 'காலை', 'மாலை' ], mmmm: _M('ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்'), dddd: _W('ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி'), - currency: '₹' + currency: '₹', + format: xf({ d: 1, y: 0, f: 2, o: 1, k: '-', b: ':', s: 1 }) }), 'ta'); addLocale({ @@ -921,7 +1018,8 @@ export function initLocales () { mmm: _M('జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం'), dddd: _W('ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం'), ddd: _W('ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని'), - currency: '₹' + currency: '₹', + format: xf({ d: 1, h: 0, y: 0, f: 0, o: 1, k: '-', b: ':', s: 0 }) }, 'te'); addLocale({ @@ -931,7 +1029,8 @@ export function initLocales () { dddd: _W("неділя;понеділок;вівторок;середа;четвер;п'ятниця;субота"), ddd: _W('Нд;Пн;Вт;Ср;Чт;Пт;Сб'), ampm: _B('дп;пп'), - currency: '₴' + currency: '₴', + format: xf({ h: 0, k: '.', l: '.' }) }, 'uk'); addLocale({ @@ -942,7 +1041,8 @@ export function initLocales () { dddd: _W('Chủ Nhật;~Hai;~Ba;~Tư;~Năm;~Sáu;~Bảy', 'Thứ '), ddd: _W('CN;T2;T3;T4;T5;T6;T7'), ampm: _B('SA;CH'), - currency: '₫' + currency: '₫', + format: xf({ h: 0, d: 1 }) }, 'vi'); addLocale(xm({ @@ -963,7 +1063,8 @@ export function initLocales () { ماجنتا: 'Magenta', سماوي: 'Cyan' }, - currency: '⃁' + currency: '⃁', + format: xf({ f: 2, i: 1, y: 1, s: 1 }) }, 0, 0), 'ar'); addLocale({ @@ -974,7 +1075,8 @@ export function initLocales () { mmm: _M('জানু;ফেব্রু;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগ;সেপ্টে;অক্টো;নভে;ডিসে'), dddd: _W('রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার'), ddd: _W('রবি.;সোম.;মঙ্গল.;বুধ.;বৃহস্পতি.;শুক্র.;শনি.'), - currency: '₹' + currency: '₹', + format: xf({ f: 2, y: 1, k: '-', b: '.', s: 1 }) }, 'bn'); addLocale({ @@ -985,6 +1087,7 @@ export function initLocales () { dddd: _W('रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार'), ddd: _W('रवि.;सोम.;मंगल.;बुध.;गुरु.;शुक्र.;शनि.'), ampm: [ 'पूर्वाह्न', 'अपराह्न' ], - currency: '₹' + currency: '₹', + format: xf(fp4) }, 'hi'); } diff --git a/lib/parseValue/parseDateNf.ts b/lib/parseValue/parseDateNf.ts index 4ef329b..3025877 100644 --- a/lib/parseValue/parseDateNf.ts +++ b/lib/parseValue/parseDateNf.ts @@ -269,7 +269,7 @@ export function parseDateNf (value: string, l10n: LocaleData): ParseDataNum | un // possible shortcut: quickly dismiss if there isn't a number? const date = nextToken( normDateStr(value), - l10n.preferMDY ? dateTrieMD : dateTrieDM, + !l10n.format?.dateOrder ? dateTrieMD : dateTrieDM, { path: '' }, lData ); diff --git a/lib/parseValue/parseDateXl.ts b/lib/parseValue/parseDateXl.ts index 7ece15e..4cf4e7b 100644 --- a/lib/parseValue/parseDateXl.ts +++ b/lib/parseValue/parseDateXl.ts @@ -140,7 +140,7 @@ export function parseDateXl (value: string, l10n: LocaleData): ParseDataNum | un bits.length = 5; } - const isMDY = l10n.preferMDY; + const isMDY = !l10n.format?.dateOrder; if (bits.length === 5) { const [ a, b, c, d, e ] = bits; const [ nMon, nDay ] = isMDY ? [ a, c ] : [ c, a ]; diff --git a/lib/parseValue/parseValue.ts b/lib/parseValue/parseValue.ts index e20dbfd..0432a56 100644 --- a/lib/parseValue/parseValue.ts +++ b/lib/parseValue/parseValue.ts @@ -58,7 +58,7 @@ import type { ParseDataBool, ParseDataNum, ParseValueOptions } from './types.ts' * @returns An object of the parsed value and a corresponding format string */ export function parseValue (value: string, options?: ParseValueOptions): ParseDataNum | ParseDataBool | undefined { - const l10n = getLocale(options?.locale || '') || defaultLocale; + const l10n = getLocale(options?.locale || 'en-US') || defaultLocale; if (options?.mode === 1) { return ( parseNumberNf(value, l10n) ?? diff --git a/lib/tokenHandlers.ts b/lib/tokenHandlers.ts index 15b0465..8e863bb 100644 --- a/lib/tokenHandlers.ts +++ b/lib/tokenHandlers.ts @@ -42,19 +42,13 @@ export function getTokenHandlers (l10n: LocaleData): [ TokenType, RegExp, number const ts = reEsc(l10n.opcodes.ts ?? 's'); const wd = reEsc(l10n.opcodes.wd ?? 'a'); const en = reEsc(l10n.opcodes.en ?? 'g'); - // AAA - const ops = [ - dy + dy.toUpperCase(), - dm + dm.toUpperCase(), - dd + dd.toUpperCase(), - th + th.toUpperCase(), - tm + tm.toUpperCase(), - ts + ts.toUpperCase(), - wd + wd.toUpperCase(), - en + en.toUpperCase(), - 'bB' - ]; - reDatetime = new RegExp(`^(?:[${ops.join(']+|[')}]+|e+)`); + const ops = '' + + `[${dy + dy.toUpperCase()}]+|[${dm + dm.toUpperCase()}]+|` + + `[${dd + dd.toUpperCase()}]+|[${th + th.toUpperCase()}]+|` + + `[${tm + tm.toUpperCase()}]+|[${ts + ts.toUpperCase()}]+|` + + `[${wd + wd.toUpperCase()}]{3,}|[${en + en.toUpperCase()}]+|` + + '[bB]+|e+'; + reDatetime = new RegExp(`^(?:${ops})`); reDuration = new RegExp(`^(?:\\[(${reEsc(th)}+|${reEsc(tm)}+|${reEsc(ts)}+)\\]+)`, 'i'); } else { @@ -79,13 +73,13 @@ export function getTokenHandlers (l10n: LocaleData): [ TokenType, RegExp, number [ TOKEN_POINT, /^\./, 0 ], [ TOKEN_SPACE, /^ /, 0 ], [ TOKEN_PERCENT, /^%/, 0 ], + [ TOKEN_AMPM, /^(?:AM\/PM|am\/pm|A\/P)/, 0 ], [ TOKEN_CURRENCY, reCurrencySymbol, 0 ], [ TOKEN_DIGIT, /^[1-9]/, 0 ], [ TOKEN_CALENDAR, /^(?:B[12])/i, 0 ], [ TOKEN_ERROR, /^B$/, 0 ], // pattern must not end in a "B" [ TOKEN_DATETIME, reDatetime, 0 ], [ TOKEN_DURATION, reDuration, 1 ], - [ TOKEN_AMPM, /^(?:AM\/PM|am\/pm|A\/P)/, 0 ], [ TOKEN_CONDITION, /^\[((?:<[=>]?|>=?|=)\s*(?:-?[.\d]+))\]/, 1 ], [ TOKEN_DBNUM, /^\[(DBNum[0-4]?\d)\]/i, 1 ], [ TOKEN_NATNUM, /^\[(NatNum[0-4]?\d)\]/i, 1 ], diff --git a/test/getFormatFromId.spec.ts b/test/getFormatFromId.spec.ts new file mode 100644 index 0000000..f83023e --- /dev/null +++ b/test/getFormatFromId.spec.ts @@ -0,0 +1,4216 @@ +import { describe, expect, test } from 'vitest'; +import { getFormatFromId } from '../lib/getFormatFromId.ts'; + +describe('getFormatFromId', () => { + test('works without a locale argument', () => { + expect(getFormatFromId(1)).toBe('0'); + expect(getFormatFromId(2)).toBe('0.00'); + expect(getFormatFromId(3)).toBe('#,##0'); + expect(getFormatFromId(4)).toBe('#,##0.00'); + expect(getFormatFromId(5)).toBe('$#,##0_);($#,##0)'); + expect(getFormatFromId(6)).toBe('$#,##0_);[Red]($#,##0)'); + expect(getFormatFromId(7)).toBe('$#,##0.00_);($#,##0.00)'); + expect(getFormatFromId(8)).toBe('$#,##0.00_);[Red]($#,##0.00)'); + expect(getFormatFromId(9)).toBe('0%'); + expect(getFormatFromId(10)).toBe('0.00%'); + expect(getFormatFromId(11)).toBe('0.00E+00'); + expect(getFormatFromId(12)).toBe('# ?/?'); + expect(getFormatFromId(13)).toBe('# ??/??'); + expect(getFormatFromId(14)).toBe('m/d/yyyy'); + expect(getFormatFromId(15)).toBe('d-mmm-yy'); + expect(getFormatFromId(16)).toBe('d-mmm'); + expect(getFormatFromId(17)).toBe('mmm-yy'); + expect(getFormatFromId(18)).toBe('h:mm AM/PM'); + expect(getFormatFromId(19)).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20)).toBe('h:mm'); + expect(getFormatFromId(21)).toBe('h:mm:ss'); + expect(getFormatFromId(22)).toBe('m/d/yyyy h:mm'); + expect(getFormatFromId(27)).toBe('m/d/yyyy'); + expect(getFormatFromId(28)).toBe('m/d/yyyy'); + expect(getFormatFromId(29)).toBe('m/d/yyyy'); + expect(getFormatFromId(30)).toBe('m/d/yyyy'); + expect(getFormatFromId(31)).toBe('m/d/yyyy'); + expect(getFormatFromId(32)).toBe('h:mm:ss'); + expect(getFormatFromId(33)).toBe('h:mm:ss'); + expect(getFormatFromId(34)).toBe('h:mm:ss'); + expect(getFormatFromId(35)).toBe('h:mm:ss'); + expect(getFormatFromId(36)).toBe('m/d/yyyy'); + expect(getFormatFromId(37)).toBe('#,##0_);(#,##0)'); + expect(getFormatFromId(38)).toBe('#,##0_);[Red](#,##0)'); + expect(getFormatFromId(39)).toBe('#,##0.00_);(#,##0.00)'); + expect(getFormatFromId(40)).toBe('#,##0.00_);[Red](#,##0.00)'); + expect(getFormatFromId(41)).toBe('_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)'); + expect(getFormatFromId(42)).toBe('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)'); + expect(getFormatFromId(43)).toBe('_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)'); + expect(getFormatFromId(44)).toBe('_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'); + expect(getFormatFromId(45)).toBe('mm:ss'); + expect(getFormatFromId(46)).toBe('[h]:mm:ss'); + expect(getFormatFromId(47)).toBe('mm:ss.0'); + expect(getFormatFromId(48)).toBe('##0.0E+0'); + expect(getFormatFromId(49)).toBe('@'); + expect(getFormatFromId(50)).toBe('m/d/yyyy'); + expect(getFormatFromId(51)).toBe('m/d/yyyy'); + expect(getFormatFromId(52)).toBe('m/d/yyyy'); + expect(getFormatFromId(53)).toBe('m/d/yyyy'); + expect(getFormatFromId(54)).toBe('m/d/yyyy'); + expect(getFormatFromId(55)).toBe('m/d/yyyy'); + expect(getFormatFromId(56)).toBe('m/d/yyyy'); + expect(getFormatFromId(57)).toBe('m/d/yyyy'); + expect(getFormatFromId(58)).toBe('m/d/yyyy'); + }); + + test('behaves correctly outside of the 0-58 id range', () => { + // negative patterns return general + expect(getFormatFromId(-1)).toBe('General'); + // patterns repeat after 58... + expect(getFormatFromId(59)).toBe('0'); + expect(getFormatFromId(60)).toBe('0.00'); + expect(getFormatFromId(61)).toBe('#,##0'); + expect(getFormatFromId(62)).toBe('#,##0.00'); + }); + + test('ar-SA', () => { + expect(getFormatFromId(1, 'ar-SA')).toBe('0'); + expect(getFormatFromId(2, 'ar-SA')).toBe('0.00'); + expect(getFormatFromId(3, 'ar-SA')).toBe('#,##0'); + expect(getFormatFromId(4, 'ar-SA')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ar-SA')).toBe('⃁ #,##0;⃁ -#,##0'); + expect(getFormatFromId(6, 'ar-SA')).toBe('⃁ #,##0;[Red]⃁ -#,##0'); + expect(getFormatFromId(7, 'ar-SA')).toBe('⃁ #,##0.00;⃁ -#,##0.00'); + expect(getFormatFromId(8, 'ar-SA')).toBe('⃁ #,##0.00;[Red]⃁ -#,##0.00'); + expect(getFormatFromId(9, 'ar-SA')).toBe('0%'); + expect(getFormatFromId(10, 'ar-SA')).toBe('0.00%'); + expect(getFormatFromId(11, 'ar-SA')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ar-SA')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ar-SA')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(15, 'ar-SA')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'ar-SA')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'ar-SA')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'ar-SA')).toBe('hh:mm AM/PM'); + expect(getFormatFromId(19, 'ar-SA')).toBe('hh:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ar-SA')).toBe('hh:mm'); + expect(getFormatFromId(21, 'ar-SA')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'ar-SA')).toBe('dd/mm/yy hh:mm'); + expect(getFormatFromId(27, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(28, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(29, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(30, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(31, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(32, 'ar-SA')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'ar-SA')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'ar-SA')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'ar-SA')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(37, 'ar-SA')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ar-SA')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ar-SA')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ar-SA')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ar-SA')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'ar-SA')).toBe('_ ⃁ * #,##0_ ;_ ⃁ * -#,##0_ ;_ ⃁ * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'ar-SA')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'ar-SA')).toBe('_ ⃁ * #,##0.00_ ;_ ⃁ * -#,##0.00_ ;_ ⃁ * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'ar-SA')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ar-SA')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ar-SA')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ar-SA')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ar-SA')).toBe('@'); + expect(getFormatFromId(50, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(51, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(52, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(53, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(54, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(55, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(56, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(57, 'ar-SA')).toBe('dd/mm/yy'); + expect(getFormatFromId(58, 'ar-SA')).toBe('dd/mm/yy'); + }); + test('az-AZ', () => { + expect(getFormatFromId(1, 'az-AZ')).toBe('0'); + expect(getFormatFromId(2, 'az-AZ')).toBe('0.00'); + expect(getFormatFromId(3, 'az-AZ')).toBe('#,##0'); + expect(getFormatFromId(4, 'az-AZ')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'az-AZ')).toBe('#,##0 ₼;-#,##0 ₼'); + expect(getFormatFromId(6, 'az-AZ')).toBe('#,##0 ₼;[Red]-#,##0 ₼'); + expect(getFormatFromId(7, 'az-AZ')).toBe('#,##0.00 ₼;-#,##0.00 ₼'); + expect(getFormatFromId(8, 'az-AZ')).toBe('#,##0.00 ₼;[Red]-#,##0.00 ₼'); + expect(getFormatFromId(9, 'az-AZ')).toBe('0%'); + expect(getFormatFromId(10, 'az-AZ')).toBe('0.00%'); + expect(getFormatFromId(11, 'az-AZ')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'az-AZ')).toBe('# ?/?'); + expect(getFormatFromId(13, 'az-AZ')).toBe('# ??/??'); + expect(getFormatFromId(14, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'az-AZ')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'az-AZ')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'az-AZ')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'az-AZ')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'az-AZ')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'az-AZ')).toBe('hh:mm'); + expect(getFormatFromId(21, 'az-AZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'az-AZ')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'az-AZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'az-AZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'az-AZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'az-AZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'az-AZ')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'az-AZ')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'az-AZ')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'az-AZ')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'az-AZ')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'az-AZ')).toBe('_-* #,##0 ₼_-;-* #,##0 ₼_-;_-* "-" ₼_-;_-@_-'); + expect(getFormatFromId(43, 'az-AZ')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'az-AZ')).toBe('_-* #,##0.00 ₼_-;-* #,##0.00 ₼_-;_-* "-"?? ₼_-;_-@_-'); + expect(getFormatFromId(45, 'az-AZ')).toBe('mm:ss'); + expect(getFormatFromId(46, 'az-AZ')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'az-AZ')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'az-AZ')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'az-AZ')).toBe('@'); + expect(getFormatFromId(50, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'az-AZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'az-AZ')).toBe('dd.mm.yyyy'); + }); + test('be-BY', () => { + expect(getFormatFromId(1, 'be-BY')).toBe('0'); + expect(getFormatFromId(2, 'be-BY')).toBe('0.00'); + expect(getFormatFromId(3, 'be-BY')).toBe('#,##0'); + expect(getFormatFromId(4, 'be-BY')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'be-BY')).toBe('#,##0 "Br";-#,##0 "Br"'); + expect(getFormatFromId(6, 'be-BY')).toBe('#,##0 "Br";[Red]-#,##0 "Br"'); + expect(getFormatFromId(7, 'be-BY')).toBe('#,##0.00 "Br";-#,##0.00 "Br"'); + expect(getFormatFromId(8, 'be-BY')).toBe('#,##0.00 "Br";[Red]-#,##0.00 "Br"'); + expect(getFormatFromId(9, 'be-BY')).toBe('0%'); + expect(getFormatFromId(10, 'be-BY')).toBe('0.00%'); + expect(getFormatFromId(11, 'be-BY')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'be-BY')).toBe('# ?/?'); + expect(getFormatFromId(13, 'be-BY')).toBe('# ??/??'); + expect(getFormatFromId(14, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(15, 'be-BY')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'be-BY')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'be-BY')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'be-BY')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'be-BY')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'be-BY')).toBe('hh:mm'); + expect(getFormatFromId(21, 'be-BY')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'be-BY')).toBe('dd.mm.yy hh:mm'); + expect(getFormatFromId(27, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(28, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(29, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(30, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(31, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(32, 'be-BY')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'be-BY')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'be-BY')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'be-BY')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(37, 'be-BY')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'be-BY')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'be-BY')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'be-BY')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'be-BY')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'be-BY')).toBe('_-* #,##0 "Br"_-;-* #,##0 "Br"_-;_-* "-" "Br"_-;_-@_-'); + expect(getFormatFromId(43, 'be-BY')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'be-BY')).toBe('_-* #,##0.00 "Br"_-;-* #,##0.00 "Br"_-;_-* "-"?? "Br"_-;_-@_-'); + expect(getFormatFromId(45, 'be-BY')).toBe('mm:ss'); + expect(getFormatFromId(46, 'be-BY')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'be-BY')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'be-BY')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'be-BY')).toBe('@'); + expect(getFormatFromId(50, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(51, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(52, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(53, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(54, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(55, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(56, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(57, 'be-BY')).toBe('dd.mm.yy'); + expect(getFormatFromId(58, 'be-BY')).toBe('dd.mm.yy'); + }); + test('bg-BG', () => { + expect(getFormatFromId(1, 'bg-BG')).toBe('0'); + expect(getFormatFromId(2, 'bg-BG')).toBe('0.00'); + expect(getFormatFromId(3, 'bg-BG')).toBe('#,##0'); + expect(getFormatFromId(4, 'bg-BG')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'bg-BG')).toBe('#,##0 "лв.";-#,##0 "лв."'); + expect(getFormatFromId(6, 'bg-BG')).toBe('#,##0 "лв.";[Red]-#,##0 "лв."'); + expect(getFormatFromId(7, 'bg-BG')).toBe('#,##0.00 "лв.";-#,##0.00 "лв."'); + expect(getFormatFromId(8, 'bg-BG')).toBe('#,##0.00 "лв.";[Red]-#,##0.00 "лв."'); + expect(getFormatFromId(9, 'bg-BG')).toBe('0%'); + expect(getFormatFromId(10, 'bg-BG')).toBe('0.00%'); + expect(getFormatFromId(11, 'bg-BG')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'bg-BG')).toBe('# ?/?'); + expect(getFormatFromId(13, 'bg-BG')).toBe('# ??/??'); + expect(getFormatFromId(14, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(15, 'bg-BG')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'bg-BG')).toBe('d.mmm'); + expect(getFormatFromId(17, 'bg-BG')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'bg-BG')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'bg-BG')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'bg-BG')).toBe('h:mm'); + expect(getFormatFromId(21, 'bg-BG')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'bg-BG')).toBe('d.m.yyyy h:mm'); + expect(getFormatFromId(27, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(28, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(29, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(30, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(31, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(32, 'bg-BG')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'bg-BG')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'bg-BG')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'bg-BG')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(37, 'bg-BG')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'bg-BG')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'bg-BG')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'bg-BG')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'bg-BG')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'bg-BG')).toBe('_-* #,##0 "лв."_-;-* #,##0 "лв."_-;_-* "-" "лв."_-;_-@_-'); + expect(getFormatFromId(43, 'bg-BG')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'bg-BG')).toBe('_-* #,##0.00 "лв."_-;-* #,##0.00 "лв."_-;_-* "-"?? "лв."_-;_-@_-'); + expect(getFormatFromId(45, 'bg-BG')).toBe('mm:ss'); + expect(getFormatFromId(46, 'bg-BG')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'bg-BG')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'bg-BG')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'bg-BG')).toBe('@'); + expect(getFormatFromId(50, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(51, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(52, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(53, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(54, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(55, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(56, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(57, 'bg-BG')).toBe('d.m.yyyy'); + expect(getFormatFromId(58, 'bg-BG')).toBe('d.m.yyyy'); + }); + test('bn-IN', () => { + expect(getFormatFromId(1, 'bn-IN')).toBe('0'); + expect(getFormatFromId(2, 'bn-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'bn-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'bn-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'bn-IN')).toBe('₹ #,##0;₹ -#,##0'); + expect(getFormatFromId(6, 'bn-IN')).toBe('₹ #,##0;[Red]₹ -#,##0'); + expect(getFormatFromId(7, 'bn-IN')).toBe('₹ #,##0.00;₹ -#,##0.00'); + expect(getFormatFromId(8, 'bn-IN')).toBe('₹ #,##0.00;[Red]₹ -#,##0.00'); + expect(getFormatFromId(9, 'bn-IN')).toBe('0%'); + expect(getFormatFromId(10, 'bn-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'bn-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'bn-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'bn-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(15, 'bn-IN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'bn-IN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'bn-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'bn-IN')).toBe('h.mm AM/PM'); + expect(getFormatFromId(19, 'bn-IN')).toBe('h.mm.ss AM/PM'); + expect(getFormatFromId(20, 'bn-IN')).toBe('hh.mm'); + expect(getFormatFromId(21, 'bn-IN')).toBe('hh.mm.ss'); + expect(getFormatFromId(22, 'bn-IN')).toBe('dd-mm-yy hh.mm'); + expect(getFormatFromId(27, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(28, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(29, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(30, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(31, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(32, 'bn-IN')).toBe('hh.mm.ss'); + expect(getFormatFromId(33, 'bn-IN')).toBe('hh.mm.ss'); + expect(getFormatFromId(34, 'bn-IN')).toBe('hh.mm.ss'); + expect(getFormatFromId(35, 'bn-IN')).toBe('hh.mm.ss'); + expect(getFormatFromId(36, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(37, 'bn-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'bn-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'bn-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'bn-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'bn-IN')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'bn-IN')).toBe('_ ₹ * #,##0_ ;_ ₹ * -#,##0_ ;_ ₹ * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'bn-IN')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'bn-IN')).toBe('_ ₹ * #,##0.00_ ;_ ₹ * -#,##0.00_ ;_ ₹ * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'bn-IN')).toBe('mm.ss'); + expect(getFormatFromId(46, 'bn-IN')).toBe('[h].mm.ss'); + expect(getFormatFromId(47, 'bn-IN')).toBe('mm.ss.0'); + expect(getFormatFromId(48, 'bn-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'bn-IN')).toBe('@'); + expect(getFormatFromId(50, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(51, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(52, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(53, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(54, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(55, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(56, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(57, 'bn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(58, 'bn-IN')).toBe('dd-mm-yy'); + }); + test('ca-ES', () => { + expect(getFormatFromId(1, 'ca-ES')).toBe('0'); + expect(getFormatFromId(2, 'ca-ES')).toBe('0.00'); + expect(getFormatFromId(3, 'ca-ES')).toBe('#,##0'); + expect(getFormatFromId(4, 'ca-ES')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ca-ES')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'ca-ES')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'ca-ES')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'ca-ES')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'ca-ES')).toBe('0%'); + expect(getFormatFromId(10, 'ca-ES')).toBe('0.00%'); + expect(getFormatFromId(11, 'ca-ES')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ca-ES')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ca-ES')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'ca-ES')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'ca-ES')).toBe('d-mmm'); + expect(getFormatFromId(17, 'ca-ES')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'ca-ES')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'ca-ES')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ca-ES')).toBe('h:mm'); + expect(getFormatFromId(21, 'ca-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'ca-ES')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'ca-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'ca-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'ca-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'ca-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'ca-ES')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ca-ES')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ca-ES')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ca-ES')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ca-ES')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'ca-ES')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'ca-ES')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'ca-ES')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'ca-ES')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ca-ES')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ca-ES')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ca-ES')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ca-ES')).toBe('@'); + expect(getFormatFromId(50, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'ca-ES')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'ca-ES')).toBe('d/m/yyyy'); + }); + test('cs-CZ', () => { + expect(getFormatFromId(1, 'cs-CZ')).toBe('0'); + expect(getFormatFromId(2, 'cs-CZ')).toBe('0.00'); + expect(getFormatFromId(3, 'cs-CZ')).toBe('#,##0'); + expect(getFormatFromId(4, 'cs-CZ')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'cs-CZ')).toBe('#,##0 "Kč";-#,##0 "Kč"'); + expect(getFormatFromId(6, 'cs-CZ')).toBe('#,##0 "Kč";[Red]-#,##0 "Kč"'); + expect(getFormatFromId(7, 'cs-CZ')).toBe('#,##0.00 "Kč";-#,##0.00 "Kč"'); + expect(getFormatFromId(8, 'cs-CZ')).toBe('#,##0.00 "Kč";[Red]-#,##0.00 "Kč"'); + expect(getFormatFromId(9, 'cs-CZ')).toBe('0%'); + expect(getFormatFromId(10, 'cs-CZ')).toBe('0.00%'); + expect(getFormatFromId(11, 'cs-CZ')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'cs-CZ')).toBe('# ?/?'); + expect(getFormatFromId(13, 'cs-CZ')).toBe('# ??/??'); + expect(getFormatFromId(14, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'cs-CZ')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'cs-CZ')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'cs-CZ')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'cs-CZ')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'cs-CZ')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'cs-CZ')).toBe('h:mm'); + expect(getFormatFromId(21, 'cs-CZ')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'cs-CZ')).toBe('dd.mm.yyyy h:mm'); + expect(getFormatFromId(27, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'cs-CZ')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'cs-CZ')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'cs-CZ')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'cs-CZ')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'cs-CZ')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'cs-CZ')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'cs-CZ')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'cs-CZ')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'cs-CZ')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'cs-CZ')).toBe('_-* #,##0 "Kč"_-;-* #,##0 "Kč"_-;_-* "-" "Kč"_-;_-@_-'); + expect(getFormatFromId(43, 'cs-CZ')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'cs-CZ')).toBe('_-* #,##0.00 "Kč"_-;-* #,##0.00 "Kč"_-;_-* "-"?? "Kč"_-;_-@_-'); + expect(getFormatFromId(45, 'cs-CZ')).toBe('mm:ss'); + expect(getFormatFromId(46, 'cs-CZ')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'cs-CZ')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'cs-CZ')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'cs-CZ')).toBe('@'); + expect(getFormatFromId(50, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'cs-CZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'cs-CZ')).toBe('dd.mm.yyyy'); + }); + test('cy-GB', () => { + expect(getFormatFromId(1, 'cy-GB')).toBe('0'); + expect(getFormatFromId(2, 'cy-GB')).toBe('0.00'); + expect(getFormatFromId(3, 'cy-GB')).toBe('#,##0'); + expect(getFormatFromId(4, 'cy-GB')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'cy-GB')).toBe('£#,##0;-£#,##0'); + expect(getFormatFromId(6, 'cy-GB')).toBe('£#,##0;[Red]-£#,##0'); + expect(getFormatFromId(7, 'cy-GB')).toBe('£#,##0.00;-£#,##0.00'); + expect(getFormatFromId(8, 'cy-GB')).toBe('£#,##0.00;[Red]-£#,##0.00'); + expect(getFormatFromId(9, 'cy-GB')).toBe('0%'); + expect(getFormatFromId(10, 'cy-GB')).toBe('0.00%'); + expect(getFormatFromId(11, 'cy-GB')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'cy-GB')).toBe('# ?/?'); + expect(getFormatFromId(13, 'cy-GB')).toBe('# ??/??'); + expect(getFormatFromId(14, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'cy-GB')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'cy-GB')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'cy-GB')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'cy-GB')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'cy-GB')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'cy-GB')).toBe('hh:mm'); + expect(getFormatFromId(21, 'cy-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'cy-GB')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'cy-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'cy-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'cy-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'cy-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'cy-GB')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'cy-GB')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'cy-GB')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'cy-GB')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'cy-GB')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'cy-GB')).toBe('_-£* #,##0_-;-£* #,##0_-;_-£* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'cy-GB')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'cy-GB')).toBe('_-£* #,##0.00_-;-£* #,##0.00_-;_-£* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'cy-GB')).toBe('mm:ss'); + expect(getFormatFromId(46, 'cy-GB')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'cy-GB')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'cy-GB')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'cy-GB')).toBe('@'); + expect(getFormatFromId(50, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'cy-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'cy-GB')).toBe('dd/mm/yyyy'); + }); + test('da-DK', () => { + expect(getFormatFromId(1, 'da-DK')).toBe('0'); + expect(getFormatFromId(2, 'da-DK')).toBe('0.00'); + expect(getFormatFromId(3, 'da-DK')).toBe('#,##0'); + expect(getFormatFromId(4, 'da-DK')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'da-DK')).toBe('#,##0 "kr.";-#,##0 "kr."'); + expect(getFormatFromId(6, 'da-DK')).toBe('#,##0 "kr.";[Red]-#,##0 "kr."'); + expect(getFormatFromId(7, 'da-DK')).toBe('#,##0.00 "kr.";-#,##0.00 "kr."'); + expect(getFormatFromId(8, 'da-DK')).toBe('#,##0.00 "kr.";[Red]-#,##0.00 "kr."'); + expect(getFormatFromId(9, 'da-DK')).toBe('0%'); + expect(getFormatFromId(10, 'da-DK')).toBe('0.00%'); + expect(getFormatFromId(11, 'da-DK')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'da-DK')).toBe('# ?/?'); + expect(getFormatFromId(13, 'da-DK')).toBe('# ??/??'); + expect(getFormatFromId(14, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(15, 'da-DK')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'da-DK')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'da-DK')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'da-DK')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'da-DK')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'da-DK')).toBe('hh:mm'); + expect(getFormatFromId(21, 'da-DK')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'da-DK')).toBe('dd-mm-yyyy hh:mm'); + expect(getFormatFromId(27, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(28, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(29, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(30, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(31, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(32, 'da-DK')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'da-DK')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'da-DK')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'da-DK')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(37, 'da-DK')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'da-DK')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'da-DK')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'da-DK')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'da-DK')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'da-DK')).toBe('_-* #,##0 "kr."_-;-* #,##0 "kr."_-;_-* "-" "kr."_-;_-@_-'); + expect(getFormatFromId(43, 'da-DK')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'da-DK')).toBe('_-* #,##0.00 "kr."_-;-* #,##0.00 "kr."_-;_-* "-"?? "kr."_-;_-@_-'); + expect(getFormatFromId(45, 'da-DK')).toBe('mm:ss'); + expect(getFormatFromId(46, 'da-DK')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'da-DK')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'da-DK')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'da-DK')).toBe('@'); + expect(getFormatFromId(50, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(51, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(52, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(53, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(54, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(55, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(56, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(57, 'da-DK')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(58, 'da-DK')).toBe('dd-mm-yyyy'); + }); + test('de-CH', () => { + expect(getFormatFromId(1, 'de-CH')).toBe('0'); + expect(getFormatFromId(2, 'de-CH')).toBe('0.00'); + expect(getFormatFromId(3, 'de-CH')).toBe('#,##0'); + expect(getFormatFromId(4, 'de-CH')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'de-CH')).toBe('"CHF" #,##0;"CHF" -#,##0'); + expect(getFormatFromId(6, 'de-CH')).toBe('"CHF" #,##0;[Red]"CHF" -#,##0'); + expect(getFormatFromId(7, 'de-CH')).toBe('"CHF" #,##0.00;"CHF" -#,##0.00'); + expect(getFormatFromId(8, 'de-CH')).toBe('"CHF" #,##0.00;[Red]"CHF" -#,##0.00'); + expect(getFormatFromId(9, 'de-CH')).toBe('0%'); + expect(getFormatFromId(10, 'de-CH')).toBe('0.00%'); + expect(getFormatFromId(11, 'de-CH')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'de-CH')).toBe('# ?/?'); + expect(getFormatFromId(13, 'de-CH')).toBe('# ??/??'); + expect(getFormatFromId(14, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'de-CH')).toBe('dd. mmm yy'); + expect(getFormatFromId(16, 'de-CH')).toBe('dd. mmm'); + expect(getFormatFromId(17, 'de-CH')).toBe('mmm yy'); + expect(getFormatFromId(18, 'de-CH')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'de-CH')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'de-CH')).toBe('hh:mm'); + expect(getFormatFromId(21, 'de-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'de-CH')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'de-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'de-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'de-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'de-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'de-CH')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'de-CH')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'de-CH')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'de-CH')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'de-CH')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'de-CH')).toBe('_ "CHF" * #,##0_ ;_ "CHF" * -#,##0_ ;_ "CHF" * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'de-CH')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'de-CH')).toBe('_ "CHF" * #,##0.00_ ;_ "CHF" * -#,##0.00_ ;_ "CHF" * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'de-CH')).toBe('mm:ss'); + expect(getFormatFromId(46, 'de-CH')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'de-CH')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'de-CH')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'de-CH')).toBe('@'); + expect(getFormatFromId(50, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'de-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'de-CH')).toBe('dd.mm.yyyy'); + }); + test('de-DE', () => { + expect(getFormatFromId(1, 'de-DE')).toBe('0'); + expect(getFormatFromId(2, 'de-DE')).toBe('0.00'); + expect(getFormatFromId(3, 'de-DE')).toBe('#,##0'); + expect(getFormatFromId(4, 'de-DE')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'de-DE')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'de-DE')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'de-DE')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'de-DE')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'de-DE')).toBe('0%'); + expect(getFormatFromId(10, 'de-DE')).toBe('0.00%'); + expect(getFormatFromId(11, 'de-DE')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'de-DE')).toBe('# ?/?'); + expect(getFormatFromId(13, 'de-DE')).toBe('# ??/??'); + expect(getFormatFromId(14, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'de-DE')).toBe('dd. mmm yy'); + expect(getFormatFromId(16, 'de-DE')).toBe('dd. mmm'); + expect(getFormatFromId(17, 'de-DE')).toBe('mmm yy'); + expect(getFormatFromId(18, 'de-DE')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'de-DE')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'de-DE')).toBe('hh:mm'); + expect(getFormatFromId(21, 'de-DE')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'de-DE')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'de-DE')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'de-DE')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'de-DE')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'de-DE')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'de-DE')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'de-DE')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'de-DE')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'de-DE')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'de-DE')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'de-DE')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'de-DE')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'de-DE')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'de-DE')).toBe('mm:ss'); + expect(getFormatFromId(46, 'de-DE')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'de-DE')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'de-DE')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'de-DE')).toBe('@'); + expect(getFormatFromId(50, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'de-DE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'de-DE')).toBe('dd.mm.yyyy'); + }); + test('el-GR', () => { + expect(getFormatFromId(1, 'el-GR')).toBe('0'); + expect(getFormatFromId(2, 'el-GR')).toBe('0.00'); + expect(getFormatFromId(3, 'el-GR')).toBe('#,##0'); + expect(getFormatFromId(4, 'el-GR')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'el-GR')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'el-GR')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'el-GR')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'el-GR')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'el-GR')).toBe('0%'); + expect(getFormatFromId(10, 'el-GR')).toBe('0.00%'); + expect(getFormatFromId(11, 'el-GR')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'el-GR')).toBe('# ?/?'); + expect(getFormatFromId(13, 'el-GR')).toBe('# ??/??'); + expect(getFormatFromId(14, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'el-GR')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'el-GR')).toBe('d-mmm'); + expect(getFormatFromId(17, 'el-GR')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'el-GR')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'el-GR')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'el-GR')).toBe('h:mm'); + expect(getFormatFromId(21, 'el-GR')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'el-GR')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'el-GR')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'el-GR')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'el-GR')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'el-GR')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'el-GR')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'el-GR')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'el-GR')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'el-GR')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'el-GR')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'el-GR')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'el-GR')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'el-GR')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'el-GR')).toBe('mm:ss'); + expect(getFormatFromId(46, 'el-GR')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'el-GR')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'el-GR')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'el-GR')).toBe('@'); + expect(getFormatFromId(50, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'el-GR')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'el-GR')).toBe('d/m/yyyy'); + }); + test('en-AU', () => { + expect(getFormatFromId(1, 'en-AU')).toBe('0'); + expect(getFormatFromId(2, 'en-AU')).toBe('0.00'); + expect(getFormatFromId(3, 'en-AU')).toBe('#,##0'); + expect(getFormatFromId(4, 'en-AU')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'en-AU')).toBe('$#,##0;-$#,##0'); + expect(getFormatFromId(6, 'en-AU')).toBe('$#,##0;[Red]-$#,##0'); + expect(getFormatFromId(7, 'en-AU')).toBe('$#,##0.00;-$#,##0.00'); + expect(getFormatFromId(8, 'en-AU')).toBe('$#,##0.00;[Red]-$#,##0.00'); + expect(getFormatFromId(9, 'en-AU')).toBe('0%'); + expect(getFormatFromId(10, 'en-AU')).toBe('0.00%'); + expect(getFormatFromId(11, 'en-AU')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'en-AU')).toBe('# ?/?'); + expect(getFormatFromId(13, 'en-AU')).toBe('# ??/??'); + expect(getFormatFromId(14, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(15, 'en-AU')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'en-AU')).toBe('d-mmm'); + expect(getFormatFromId(17, 'en-AU')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'en-AU')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'en-AU')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'en-AU')).toBe('h:mm'); + expect(getFormatFromId(21, 'en-AU')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'en-AU')).toBe('d/mm/yyyy h:mm'); + expect(getFormatFromId(27, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(28, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(29, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(30, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(31, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(32, 'en-AU')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'en-AU')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'en-AU')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'en-AU')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(37, 'en-AU')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'en-AU')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'en-AU')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'en-AU')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'en-AU')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'en-AU')).toBe('_-$* #,##0_-;-$* #,##0_-;_-$* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'en-AU')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'en-AU')).toBe('_-$* #,##0.00_-;-$* #,##0.00_-;_-$* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'en-AU')).toBe('mm:ss'); + expect(getFormatFromId(46, 'en-AU')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'en-AU')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'en-AU')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'en-AU')).toBe('@'); + expect(getFormatFromId(50, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(51, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(52, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(53, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(54, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(55, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(56, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(57, 'en-AU')).toBe('d/mm/yyyy'); + expect(getFormatFromId(58, 'en-AU')).toBe('d/mm/yyyy'); + }); + test('en-CA', () => { + expect(getFormatFromId(1, 'en-CA')).toBe('0'); + expect(getFormatFromId(2, 'en-CA')).toBe('0.00'); + expect(getFormatFromId(3, 'en-CA')).toBe('#,##0'); + expect(getFormatFromId(4, 'en-CA')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'en-CA')).toBe('$#,##0;-$#,##0'); + expect(getFormatFromId(6, 'en-CA')).toBe('$#,##0;[Red]-$#,##0'); + expect(getFormatFromId(7, 'en-CA')).toBe('$#,##0.00;-$#,##0.00'); + expect(getFormatFromId(8, 'en-CA')).toBe('$#,##0.00;[Red]-$#,##0.00'); + expect(getFormatFromId(9, 'en-CA')).toBe('0%'); + expect(getFormatFromId(10, 'en-CA')).toBe('0.00%'); + expect(getFormatFromId(11, 'en-CA')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'en-CA')).toBe('# ?/?'); + expect(getFormatFromId(13, 'en-CA')).toBe('# ??/??'); + expect(getFormatFromId(14, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(15, 'en-CA')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'en-CA')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'en-CA')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'en-CA')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'en-CA')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'en-CA')).toBe('h:mm'); + expect(getFormatFromId(21, 'en-CA')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'en-CA')).toBe('yyyy-mm-dd h:mm'); + expect(getFormatFromId(27, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(28, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(29, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(30, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(31, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(32, 'en-CA')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'en-CA')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'en-CA')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'en-CA')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(37, 'en-CA')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'en-CA')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'en-CA')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'en-CA')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'en-CA')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'en-CA')).toBe('_-$* #,##0_-;-$* #,##0_-;_-$* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'en-CA')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'en-CA')).toBe('_-$* #,##0.00_-;-$* #,##0.00_-;_-$* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'en-CA')).toBe('mm:ss'); + expect(getFormatFromId(46, 'en-CA')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'en-CA')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'en-CA')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'en-CA')).toBe('@'); + expect(getFormatFromId(50, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(51, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(52, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(53, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(54, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(55, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(56, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(57, 'en-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(58, 'en-CA')).toBe('yyyy-mm-dd'); + }); + test('en-GB', () => { + expect(getFormatFromId(1, 'en-GB')).toBe('0'); + expect(getFormatFromId(2, 'en-GB')).toBe('0.00'); + expect(getFormatFromId(3, 'en-GB')).toBe('#,##0'); + expect(getFormatFromId(4, 'en-GB')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'en-GB')).toBe('£#,##0;-£#,##0'); + expect(getFormatFromId(6, 'en-GB')).toBe('£#,##0;[Red]-£#,##0'); + expect(getFormatFromId(7, 'en-GB')).toBe('£#,##0.00;-£#,##0.00'); + expect(getFormatFromId(8, 'en-GB')).toBe('£#,##0.00;[Red]-£#,##0.00'); + expect(getFormatFromId(9, 'en-GB')).toBe('0%'); + expect(getFormatFromId(10, 'en-GB')).toBe('0.00%'); + expect(getFormatFromId(11, 'en-GB')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'en-GB')).toBe('# ?/?'); + expect(getFormatFromId(13, 'en-GB')).toBe('# ??/??'); + expect(getFormatFromId(14, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'en-GB')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'en-GB')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'en-GB')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'en-GB')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'en-GB')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'en-GB')).toBe('hh:mm'); + expect(getFormatFromId(21, 'en-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'en-GB')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'en-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'en-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'en-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'en-GB')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'en-GB')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'en-GB')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'en-GB')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'en-GB')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'en-GB')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'en-GB')).toBe('_-£* #,##0_-;-£* #,##0_-;_-£* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'en-GB')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'en-GB')).toBe('_-£* #,##0.00_-;-£* #,##0.00_-;_-£* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'en-GB')).toBe('mm:ss'); + expect(getFormatFromId(46, 'en-GB')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'en-GB')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'en-GB')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'en-GB')).toBe('@'); + expect(getFormatFromId(50, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'en-GB')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'en-GB')).toBe('dd/mm/yyyy'); + }); + test('en-IE', () => { + expect(getFormatFromId(1, 'en-IE')).toBe('0'); + expect(getFormatFromId(2, 'en-IE')).toBe('0.00'); + expect(getFormatFromId(3, 'en-IE')).toBe('#,##0'); + expect(getFormatFromId(4, 'en-IE')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'en-IE')).toBe('€#,##0;-€#,##0'); + expect(getFormatFromId(6, 'en-IE')).toBe('€#,##0;[Red]-€#,##0'); + expect(getFormatFromId(7, 'en-IE')).toBe('€#,##0.00;-€#,##0.00'); + expect(getFormatFromId(8, 'en-IE')).toBe('€#,##0.00;[Red]-€#,##0.00'); + expect(getFormatFromId(9, 'en-IE')).toBe('0%'); + expect(getFormatFromId(10, 'en-IE')).toBe('0.00%'); + expect(getFormatFromId(11, 'en-IE')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'en-IE')).toBe('# ?/?'); + expect(getFormatFromId(13, 'en-IE')).toBe('# ??/??'); + expect(getFormatFromId(14, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'en-IE')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'en-IE')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'en-IE')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'en-IE')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'en-IE')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'en-IE')).toBe('hh:mm'); + expect(getFormatFromId(21, 'en-IE')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'en-IE')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'en-IE')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'en-IE')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'en-IE')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'en-IE')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'en-IE')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'en-IE')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'en-IE')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'en-IE')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'en-IE')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'en-IE')).toBe('_-€* #,##0_-;-€* #,##0_-;_-€* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'en-IE')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'en-IE')).toBe('_-€* #,##0.00_-;-€* #,##0.00_-;_-€* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'en-IE')).toBe('mm:ss'); + expect(getFormatFromId(46, 'en-IE')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'en-IE')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'en-IE')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'en-IE')).toBe('@'); + expect(getFormatFromId(50, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'en-IE')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'en-IE')).toBe('dd/mm/yyyy'); + }); + test('en-US', () => { + expect(getFormatFromId(1, 'en-US')).toBe('0'); + expect(getFormatFromId(2, 'en-US')).toBe('0.00'); + expect(getFormatFromId(3, 'en-US')).toBe('#,##0'); + expect(getFormatFromId(4, 'en-US')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'en-US')).toBe('$#,##0_);($#,##0)'); + expect(getFormatFromId(6, 'en-US')).toBe('$#,##0_);[Red]($#,##0)'); + expect(getFormatFromId(7, 'en-US')).toBe('$#,##0.00_);($#,##0.00)'); + expect(getFormatFromId(8, 'en-US')).toBe('$#,##0.00_);[Red]($#,##0.00)'); + expect(getFormatFromId(9, 'en-US')).toBe('0%'); + expect(getFormatFromId(10, 'en-US')).toBe('0.00%'); + expect(getFormatFromId(11, 'en-US')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'en-US')).toBe('# ?/?'); + expect(getFormatFromId(13, 'en-US')).toBe('# ??/??'); + expect(getFormatFromId(14, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(15, 'en-US')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'en-US')).toBe('d-mmm'); + expect(getFormatFromId(17, 'en-US')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'en-US')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'en-US')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'en-US')).toBe('h:mm'); + expect(getFormatFromId(21, 'en-US')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'en-US')).toBe('m/d/yyyy h:mm'); + expect(getFormatFromId(27, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(28, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(29, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(30, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(31, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(32, 'en-US')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'en-US')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'en-US')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'en-US')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(37, 'en-US')).toBe('#,##0_);(#,##0)'); + expect(getFormatFromId(38, 'en-US')).toBe('#,##0_);[Red](#,##0)'); + expect(getFormatFromId(39, 'en-US')).toBe('#,##0.00_);(#,##0.00)'); + expect(getFormatFromId(40, 'en-US')).toBe('#,##0.00_);[Red](#,##0.00)'); + expect(getFormatFromId(41, 'en-US')).toBe('_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)'); + expect(getFormatFromId(42, 'en-US')).toBe('_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)'); + expect(getFormatFromId(43, 'en-US')).toBe('_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)'); + expect(getFormatFromId(44, 'en-US')).toBe('_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)'); + expect(getFormatFromId(45, 'en-US')).toBe('mm:ss'); + expect(getFormatFromId(46, 'en-US')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'en-US')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'en-US')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'en-US')).toBe('@'); + expect(getFormatFromId(50, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(51, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(52, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(53, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(54, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(55, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(56, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(57, 'en-US')).toBe('m/d/yyyy'); + expect(getFormatFromId(58, 'en-US')).toBe('m/d/yyyy'); + }); + test('es-AR', () => { + expect(getFormatFromId(1, 'es-AR')).toBe('0'); + expect(getFormatFromId(2, 'es-AR')).toBe('0.00'); + expect(getFormatFromId(3, 'es-AR')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-AR')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-AR')).toBe('$ #,##0;-$ #,##0'); + expect(getFormatFromId(6, 'es-AR')).toBe('$ #,##0;[Red]-$ #,##0'); + expect(getFormatFromId(7, 'es-AR')).toBe('$ #,##0.00;-$ #,##0.00'); + expect(getFormatFromId(8, 'es-AR')).toBe('$ #,##0.00;[Red]-$ #,##0.00'); + expect(getFormatFromId(9, 'es-AR')).toBe('0%'); + expect(getFormatFromId(10, 'es-AR')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-AR')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-AR')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-AR')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'es-AR')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'es-AR')).toBe('d-mmm'); + expect(getFormatFromId(17, 'es-AR')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-AR')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-AR')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-AR')).toBe('hh:mm'); + expect(getFormatFromId(21, 'es-AR')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'es-AR')).toBe('d/m/yyyy hh:mm'); + expect(getFormatFromId(27, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'es-AR')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'es-AR')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'es-AR')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'es-AR')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'es-AR')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-AR')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-AR')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-AR')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-AR')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'es-AR')).toBe('_-$ * #,##0_-;-$ * #,##0_-;_-$ * "-"_-;_-@_-'); + expect(getFormatFromId(43, 'es-AR')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'es-AR')).toBe('_-$ * #,##0.00_-;-$ * #,##0.00_-;_-$ * "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'es-AR')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-AR')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-AR')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-AR')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-AR')).toBe('@'); + expect(getFormatFromId(50, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'es-AR')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'es-AR')).toBe('d/m/yyyy'); + }); + test('es-BO', () => { + expect(getFormatFromId(1, 'es-BO')).toBe('0'); + expect(getFormatFromId(2, 'es-BO')).toBe('0.00'); + expect(getFormatFromId(3, 'es-BO')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-BO')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-BO')).toBe('"Bs"#,##0;-"Bs"#,##0'); + expect(getFormatFromId(6, 'es-BO')).toBe('"Bs"#,##0;[Red]-"Bs"#,##0'); + expect(getFormatFromId(7, 'es-BO')).toBe('"Bs"#,##0.00;-"Bs"#,##0.00'); + expect(getFormatFromId(8, 'es-BO')).toBe('"Bs"#,##0.00;[Red]-"Bs"#,##0.00'); + expect(getFormatFromId(9, 'es-BO')).toBe('0%'); + expect(getFormatFromId(10, 'es-BO')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-BO')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-BO')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-BO')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'es-BO')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'es-BO')).toBe('d-mmm'); + expect(getFormatFromId(17, 'es-BO')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-BO')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-BO')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-BO')).toBe('hh:mm'); + expect(getFormatFromId(21, 'es-BO')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'es-BO')).toBe('d/m/yyyy hh:mm'); + expect(getFormatFromId(27, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'es-BO')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'es-BO')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'es-BO')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'es-BO')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'es-BO')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-BO')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-BO')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-BO')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-BO')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'es-BO')).toBe('_-"Bs"* #,##0_-;-"Bs"* #,##0_-;_-"Bs"* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'es-BO')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'es-BO')).toBe('_-"Bs"* #,##0.00_-;-"Bs"* #,##0.00_-;_-"Bs"* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'es-BO')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-BO')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-BO')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-BO')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-BO')).toBe('@'); + expect(getFormatFromId(50, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'es-BO')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'es-BO')).toBe('d/m/yyyy'); + }); + test('es-CL', () => { + expect(getFormatFromId(1, 'es-CL')).toBe('0'); + expect(getFormatFromId(2, 'es-CL')).toBe('0.00'); + expect(getFormatFromId(3, 'es-CL')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-CL')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-CL')).toBe('$#,##0;$-#,##0'); + expect(getFormatFromId(6, 'es-CL')).toBe('$#,##0;[Red]$-#,##0'); + expect(getFormatFromId(7, 'es-CL')).toBe('$#,##0.00;$-#,##0.00'); + expect(getFormatFromId(8, 'es-CL')).toBe('$#,##0.00;[Red]$-#,##0.00'); + expect(getFormatFromId(9, 'es-CL')).toBe('0%'); + expect(getFormatFromId(10, 'es-CL')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-CL')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-CL')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-CL')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(15, 'es-CL')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'es-CL')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'es-CL')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-CL')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-CL')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-CL')).toBe('h:mm'); + expect(getFormatFromId(21, 'es-CL')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'es-CL')).toBe('dd-mm-yyyy h:mm'); + expect(getFormatFromId(27, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(28, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(29, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(30, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(31, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(32, 'es-CL')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'es-CL')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'es-CL')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'es-CL')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(37, 'es-CL')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-CL')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-CL')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-CL')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-CL')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'es-CL')).toBe('_ $* #,##0_ ;_ $* -#,##0_ ;_ $* "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'es-CL')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'es-CL')).toBe('_ $* #,##0.00_ ;_ $* -#,##0.00_ ;_ $* "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'es-CL')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-CL')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-CL')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-CL')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-CL')).toBe('@'); + expect(getFormatFromId(50, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(51, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(52, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(53, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(54, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(55, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(56, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(57, 'es-CL')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(58, 'es-CL')).toBe('dd-mm-yyyy'); + }); + test('es-CO', () => { + expect(getFormatFromId(1, 'es-CO')).toBe('0'); + expect(getFormatFromId(2, 'es-CO')).toBe('0.00'); + expect(getFormatFromId(3, 'es-CO')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-CO')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-CO')).toBe('$ #,##0;-$ #,##0'); + expect(getFormatFromId(6, 'es-CO')).toBe('$ #,##0;[Red]-$ #,##0'); + expect(getFormatFromId(7, 'es-CO')).toBe('$ #,##0.00;-$ #,##0.00'); + expect(getFormatFromId(8, 'es-CO')).toBe('$ #,##0.00;[Red]-$ #,##0.00'); + expect(getFormatFromId(9, 'es-CO')).toBe('0%'); + expect(getFormatFromId(10, 'es-CO')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-CO')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-CO')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-CO')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(15, 'es-CO')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'es-CO')).toBe('d-mmm'); + expect(getFormatFromId(17, 'es-CO')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-CO')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-CO')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-CO')).toBe('h:mm'); + expect(getFormatFromId(21, 'es-CO')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'es-CO')).toBe('d/mm/yyyy h:mm'); + expect(getFormatFromId(27, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(28, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(29, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(30, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(31, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(32, 'es-CO')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'es-CO')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'es-CO')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'es-CO')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(37, 'es-CO')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-CO')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-CO')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-CO')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-CO')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'es-CO')).toBe('_-$ * #,##0_-;-$ * #,##0_-;_-$ * "-"_-;_-@_-'); + expect(getFormatFromId(43, 'es-CO')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'es-CO')).toBe('_-$ * #,##0.00_-;-$ * #,##0.00_-;_-$ * "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'es-CO')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-CO')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-CO')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-CO')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-CO')).toBe('@'); + expect(getFormatFromId(50, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(51, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(52, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(53, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(54, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(55, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(56, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(57, 'es-CO')).toBe('d/mm/yyyy'); + expect(getFormatFromId(58, 'es-CO')).toBe('d/mm/yyyy'); + }); + test('es-EC', () => { + expect(getFormatFromId(1, 'es-EC')).toBe('0'); + expect(getFormatFromId(2, 'es-EC')).toBe('0.00'); + expect(getFormatFromId(3, 'es-EC')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-EC')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-EC')).toBe('$#,##0;$-#,##0'); + expect(getFormatFromId(6, 'es-EC')).toBe('$#,##0;[Red]$-#,##0'); + expect(getFormatFromId(7, 'es-EC')).toBe('$#,##0.00;$-#,##0.00'); + expect(getFormatFromId(8, 'es-EC')).toBe('$#,##0.00;[Red]$-#,##0.00'); + expect(getFormatFromId(9, 'es-EC')).toBe('0%'); + expect(getFormatFromId(10, 'es-EC')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-EC')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-EC')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-EC')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'es-EC')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'es-EC')).toBe('d-mmm'); + expect(getFormatFromId(17, 'es-EC')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-EC')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-EC')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-EC')).toBe('h:mm'); + expect(getFormatFromId(21, 'es-EC')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'es-EC')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'es-EC')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'es-EC')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'es-EC')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'es-EC')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'es-EC')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-EC')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-EC')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-EC')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-EC')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'es-EC')).toBe('_ $* #,##0_ ;_ $* -#,##0_ ;_ $* "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'es-EC')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'es-EC')).toBe('_ $* #,##0.00_ ;_ $* -#,##0.00_ ;_ $* "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'es-EC')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-EC')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-EC')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-EC')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-EC')).toBe('@'); + expect(getFormatFromId(50, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'es-EC')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'es-EC')).toBe('d/m/yyyy'); + }); + test('es-ES', () => { + expect(getFormatFromId(1, 'es-ES')).toBe('0'); + expect(getFormatFromId(2, 'es-ES')).toBe('0.00'); + expect(getFormatFromId(3, 'es-ES')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-ES')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-ES')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'es-ES')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'es-ES')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'es-ES')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'es-ES')).toBe('0%'); + expect(getFormatFromId(10, 'es-ES')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-ES')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-ES')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-ES')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'es-ES')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'es-ES')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'es-ES')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-ES')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-ES')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-ES')).toBe('h:mm'); + expect(getFormatFromId(21, 'es-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'es-ES')).toBe('dd/mm/yyyy h:mm'); + expect(getFormatFromId(27, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'es-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'es-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'es-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'es-ES')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'es-ES')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-ES')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-ES')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-ES')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-ES')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'es-ES')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'es-ES')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'es-ES')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'es-ES')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-ES')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-ES')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-ES')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-ES')).toBe('@'); + expect(getFormatFromId(50, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'es-ES')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'es-ES')).toBe('dd/mm/yyyy'); + }); + test('es-MX', () => { + expect(getFormatFromId(1, 'es-MX')).toBe('0'); + expect(getFormatFromId(2, 'es-MX')).toBe('0.00'); + expect(getFormatFromId(3, 'es-MX')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-MX')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-MX')).toBe('$#,##0;-$#,##0'); + expect(getFormatFromId(6, 'es-MX')).toBe('$#,##0;[Red]-$#,##0'); + expect(getFormatFromId(7, 'es-MX')).toBe('$#,##0.00;-$#,##0.00'); + expect(getFormatFromId(8, 'es-MX')).toBe('$#,##0.00;[Red]-$#,##0.00'); + expect(getFormatFromId(9, 'es-MX')).toBe('0%'); + expect(getFormatFromId(10, 'es-MX')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-MX')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-MX')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-MX')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'es-MX')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'es-MX')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'es-MX')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-MX')).toBe('hh:mm AM/PM'); + expect(getFormatFromId(19, 'es-MX')).toBe('hh:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-MX')).toBe('hh:mm'); + expect(getFormatFromId(21, 'es-MX')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'es-MX')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'es-MX')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'es-MX')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'es-MX')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'es-MX')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'es-MX')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-MX')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-MX')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-MX')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-MX')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'es-MX')).toBe('_-$* #,##0_-;-$* #,##0_-;_-$* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'es-MX')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'es-MX')).toBe('_-$* #,##0.00_-;-$* #,##0.00_-;_-$* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'es-MX')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-MX')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-MX')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-MX')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-MX')).toBe('@'); + expect(getFormatFromId(50, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'es-MX')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'es-MX')).toBe('dd/mm/yyyy'); + }); + test('es-PY', () => { + expect(getFormatFromId(1, 'es-PY')).toBe('0'); + expect(getFormatFromId(2, 'es-PY')).toBe('0.00'); + expect(getFormatFromId(3, 'es-PY')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-PY')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-PY')).toBe('₲ #,##0;₲ -#,##0'); + expect(getFormatFromId(6, 'es-PY')).toBe('₲ #,##0;[Red]₲ -#,##0'); + expect(getFormatFromId(7, 'es-PY')).toBe('₲ #,##0.00;₲ -#,##0.00'); + expect(getFormatFromId(8, 'es-PY')).toBe('₲ #,##0.00;[Red]₲ -#,##0.00'); + expect(getFormatFromId(9, 'es-PY')).toBe('0%'); + expect(getFormatFromId(10, 'es-PY')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-PY')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-PY')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-PY')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'es-PY')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'es-PY')).toBe('d-mmm'); + expect(getFormatFromId(17, 'es-PY')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-PY')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-PY')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-PY')).toBe('hh:mm'); + expect(getFormatFromId(21, 'es-PY')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'es-PY')).toBe('d/m/yyyy hh:mm'); + expect(getFormatFromId(27, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'es-PY')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'es-PY')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'es-PY')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'es-PY')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'es-PY')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-PY')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-PY')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-PY')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-PY')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'es-PY')).toBe('_ ₲ * #,##0_ ;_ ₲ * -#,##0_ ;_ ₲ * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'es-PY')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'es-PY')).toBe('_ ₲ * #,##0.00_ ;_ ₲ * -#,##0.00_ ;_ ₲ * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'es-PY')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-PY')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-PY')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-PY')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-PY')).toBe('@'); + expect(getFormatFromId(50, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'es-PY')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'es-PY')).toBe('d/m/yyyy'); + }); + test('es-UY', () => { + expect(getFormatFromId(1, 'es-UY')).toBe('0'); + expect(getFormatFromId(2, 'es-UY')).toBe('0.00'); + expect(getFormatFromId(3, 'es-UY')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-UY')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-UY')).toBe('$ #,##0;-$ #,##0'); + expect(getFormatFromId(6, 'es-UY')).toBe('$ #,##0;[Red]-$ #,##0'); + expect(getFormatFromId(7, 'es-UY')).toBe('$ #,##0.00;-$ #,##0.00'); + expect(getFormatFromId(8, 'es-UY')).toBe('$ #,##0.00;[Red]-$ #,##0.00'); + expect(getFormatFromId(9, 'es-UY')).toBe('0%'); + expect(getFormatFromId(10, 'es-UY')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-UY')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-UY')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-UY')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'es-UY')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'es-UY')).toBe('d-mmm'); + expect(getFormatFromId(17, 'es-UY')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-UY')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-UY')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-UY')).toBe('h:mm'); + expect(getFormatFromId(21, 'es-UY')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'es-UY')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'es-UY')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'es-UY')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'es-UY')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'es-UY')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'es-UY')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-UY')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-UY')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-UY')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-UY')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'es-UY')).toBe('_-$ * #,##0_-;-$ * #,##0_-;_-$ * "-"_-;_-@_-'); + expect(getFormatFromId(43, 'es-UY')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'es-UY')).toBe('_-$ * #,##0.00_-;-$ * #,##0.00_-;_-$ * "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'es-UY')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-UY')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-UY')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-UY')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-UY')).toBe('@'); + expect(getFormatFromId(50, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'es-UY')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'es-UY')).toBe('d/m/yyyy'); + }); + test('es-VE', () => { + expect(getFormatFromId(1, 'es-VE')).toBe('0'); + expect(getFormatFromId(2, 'es-VE')).toBe('0.00'); + expect(getFormatFromId(3, 'es-VE')).toBe('#,##0'); + expect(getFormatFromId(4, 'es-VE')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'es-VE')).toBe('"Bs.S"#,##0;"Bs.S"-#,##0'); + expect(getFormatFromId(6, 'es-VE')).toBe('"Bs.S"#,##0;[Red]"Bs.S"-#,##0'); + expect(getFormatFromId(7, 'es-VE')).toBe('"Bs.S"#,##0.00;"Bs.S"-#,##0.00'); + expect(getFormatFromId(8, 'es-VE')).toBe('"Bs.S"#,##0.00;[Red]"Bs.S"-#,##0.00'); + expect(getFormatFromId(9, 'es-VE')).toBe('0%'); + expect(getFormatFromId(10, 'es-VE')).toBe('0.00%'); + expect(getFormatFromId(11, 'es-VE')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'es-VE')).toBe('# ?/?'); + expect(getFormatFromId(13, 'es-VE')).toBe('# ??/??'); + expect(getFormatFromId(14, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'es-VE')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'es-VE')).toBe('d-mmm'); + expect(getFormatFromId(17, 'es-VE')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'es-VE')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'es-VE')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'es-VE')).toBe('h:mm'); + expect(getFormatFromId(21, 'es-VE')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'es-VE')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'es-VE')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'es-VE')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'es-VE')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'es-VE')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'es-VE')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'es-VE')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'es-VE')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'es-VE')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'es-VE')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'es-VE')).toBe('_ "Bs.S"* #,##0_ ;_ "Bs.S"* -#,##0_ ;_ "Bs.S"* "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'es-VE')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'es-VE')).toBe('_ "Bs.S"* #,##0.00_ ;_ "Bs.S"* -#,##0.00_ ;_ "Bs.S"* "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'es-VE')).toBe('mm:ss'); + expect(getFormatFromId(46, 'es-VE')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'es-VE')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'es-VE')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'es-VE')).toBe('@'); + expect(getFormatFromId(50, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'es-VE')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'es-VE')).toBe('d/m/yyyy'); + }); + test('fi-FI', () => { + expect(getFormatFromId(1, 'fi-FI')).toBe('0'); + expect(getFormatFromId(2, 'fi-FI')).toBe('0.00'); + expect(getFormatFromId(3, 'fi-FI')).toBe('#,##0'); + expect(getFormatFromId(4, 'fi-FI')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'fi-FI')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'fi-FI')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'fi-FI')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'fi-FI')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'fi-FI')).toBe('0 %'); + expect(getFormatFromId(10, 'fi-FI')).toBe('0.00 %'); + expect(getFormatFromId(11, 'fi-FI')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'fi-FI')).toBe('# ?/?'); + expect(getFormatFromId(13, 'fi-FI')).toBe('# ??/??'); + expect(getFormatFromId(14, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(15, 'fi-FI')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'fi-FI')).toBe('d.mmm'); + expect(getFormatFromId(17, 'fi-FI')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'fi-FI')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'fi-FI')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'fi-FI')).toBe('h:mm'); + expect(getFormatFromId(21, 'fi-FI')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'fi-FI')).toBe('d.m.yyyy h:mm'); + expect(getFormatFromId(27, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(28, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(29, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(30, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(31, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(32, 'fi-FI')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'fi-FI')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'fi-FI')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'fi-FI')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(37, 'fi-FI')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'fi-FI')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'fi-FI')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'fi-FI')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'fi-FI')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'fi-FI')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'fi-FI')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'fi-FI')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'fi-FI')).toBe('mm:ss'); + expect(getFormatFromId(46, 'fi-FI')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'fi-FI')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'fi-FI')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'fi-FI')).toBe('@'); + expect(getFormatFromId(50, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(51, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(52, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(53, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(54, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(55, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(56, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(57, 'fi-FI')).toBe('d.m.yyyy'); + expect(getFormatFromId(58, 'fi-FI')).toBe('d.m.yyyy'); + }); + test('fil-PH', () => { + expect(getFormatFromId(1, 'fil-PH')).toBe('0'); + expect(getFormatFromId(2, 'fil-PH')).toBe('0.00'); + expect(getFormatFromId(3, 'fil-PH')).toBe('#,##0'); + expect(getFormatFromId(4, 'fil-PH')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'fil-PH')).toBe('₱#,##0;-₱#,##0'); + expect(getFormatFromId(6, 'fil-PH')).toBe('₱#,##0;[Red]-₱#,##0'); + expect(getFormatFromId(7, 'fil-PH')).toBe('₱#,##0.00;-₱#,##0.00'); + expect(getFormatFromId(8, 'fil-PH')).toBe('₱#,##0.00;[Red]-₱#,##0.00'); + expect(getFormatFromId(9, 'fil-PH')).toBe('0%'); + expect(getFormatFromId(10, 'fil-PH')).toBe('0.00%'); + expect(getFormatFromId(11, 'fil-PH')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'fil-PH')).toBe('# ?/?'); + expect(getFormatFromId(13, 'fil-PH')).toBe('# ??/??'); + expect(getFormatFromId(14, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(15, 'fil-PH')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'fil-PH')).toBe('d-mmm'); + expect(getFormatFromId(17, 'fil-PH')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'fil-PH')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'fil-PH')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'fil-PH')).toBe('h:mm'); + expect(getFormatFromId(21, 'fil-PH')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'fil-PH')).toBe('m/d/yyyy h:mm'); + expect(getFormatFromId(27, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(28, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(29, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(30, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(31, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(32, 'fil-PH')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'fil-PH')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'fil-PH')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'fil-PH')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(37, 'fil-PH')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'fil-PH')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'fil-PH')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'fil-PH')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'fil-PH')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'fil-PH')).toBe('_-₱* #,##0_-;-₱* #,##0_-;_-₱* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'fil-PH')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'fil-PH')).toBe('_-₱* #,##0.00_-;-₱* #,##0.00_-;_-₱* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'fil-PH')).toBe('mm:ss'); + expect(getFormatFromId(46, 'fil-PH')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'fil-PH')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'fil-PH')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'fil-PH')).toBe('@'); + expect(getFormatFromId(50, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(51, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(52, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(53, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(54, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(55, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(56, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(57, 'fil-PH')).toBe('m/d/yyyy'); + expect(getFormatFromId(58, 'fil-PH')).toBe('m/d/yyyy'); + }); + test('fr-CA', () => { + expect(getFormatFromId(1, 'fr-CA')).toBe('0'); + expect(getFormatFromId(2, 'fr-CA')).toBe('0.00'); + expect(getFormatFromId(3, 'fr-CA')).toBe('#,##0'); + expect(getFormatFromId(4, 'fr-CA')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'fr-CA')).toBe('#,##0 $_);(#,##0 $)'); + expect(getFormatFromId(6, 'fr-CA')).toBe('#,##0 $_);[Red](#,##0 $)'); + expect(getFormatFromId(7, 'fr-CA')).toBe('#,##0.00 $_);(#,##0.00 $)'); + expect(getFormatFromId(8, 'fr-CA')).toBe('#,##0.00 $_);[Red](#,##0.00 $)'); + expect(getFormatFromId(9, 'fr-CA')).toBe('0%'); + expect(getFormatFromId(10, 'fr-CA')).toBe('0.00%'); + expect(getFormatFromId(11, 'fr-CA')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'fr-CA')).toBe('# ?/?'); + expect(getFormatFromId(13, 'fr-CA')).toBe('# ??/??'); + expect(getFormatFromId(14, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(15, 'fr-CA')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'fr-CA')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'fr-CA')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'fr-CA')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'fr-CA')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'fr-CA')).toBe('hh:mm'); + expect(getFormatFromId(21, 'fr-CA')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'fr-CA')).toBe('yyyy-mm-dd hh:mm'); + expect(getFormatFromId(27, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(28, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(29, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(30, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(31, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(32, 'fr-CA')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'fr-CA')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'fr-CA')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'fr-CA')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(37, 'fr-CA')).toBe('#,##0_);(#,##0)'); + expect(getFormatFromId(38, 'fr-CA')).toBe('#,##0_);[Red](#,##0)'); + expect(getFormatFromId(39, 'fr-CA')).toBe('#,##0.00_);(#,##0.00)'); + expect(getFormatFromId(40, 'fr-CA')).toBe('#,##0.00_);[Red](#,##0.00)'); + expect(getFormatFromId(41, 'fr-CA')).toBe('_ * #,##0_)_ ;_ * (#,##0)_ ;_ * "-"_)_ ;_ @_ '); + expect(getFormatFromId(42, 'fr-CA')).toBe('_ * #,##0_) $_ ;_ * (#,##0) $_ ;_ * "-"_) $_ ;_ @_ '); + expect(getFormatFromId(43, 'fr-CA')).toBe('_ * #,##0.00_)_ ;_ * (#,##0.00)_ ;_ * "-"??_)_ ;_ @_ '); + expect(getFormatFromId(44, 'fr-CA')).toBe('_ * #,##0.00_) $_ ;_ * (#,##0.00) $_ ;_ * "-"??_) $_ ;_ @_ '); + expect(getFormatFromId(45, 'fr-CA')).toBe('mm:ss'); + expect(getFormatFromId(46, 'fr-CA')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'fr-CA')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'fr-CA')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'fr-CA')).toBe('@'); + expect(getFormatFromId(50, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(51, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(52, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(53, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(54, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(55, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(56, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(57, 'fr-CA')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(58, 'fr-CA')).toBe('yyyy-mm-dd'); + }); + test('fr-CH', () => { + expect(getFormatFromId(1, 'fr-CH')).toBe('0'); + expect(getFormatFromId(2, 'fr-CH')).toBe('0.00'); + expect(getFormatFromId(3, 'fr-CH')).toBe('#,##0'); + expect(getFormatFromId(4, 'fr-CH')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'fr-CH')).toBe('#,##0 "CHF";-#,##0 "CHF"'); + expect(getFormatFromId(6, 'fr-CH')).toBe('#,##0 "CHF";[Red]-#,##0 "CHF"'); + expect(getFormatFromId(7, 'fr-CH')).toBe('#,##0.00 "CHF";-#,##0.00 "CHF"'); + expect(getFormatFromId(8, 'fr-CH')).toBe('#,##0.00 "CHF";[Red]-#,##0.00 "CHF"'); + expect(getFormatFromId(9, 'fr-CH')).toBe('0%'); + expect(getFormatFromId(10, 'fr-CH')).toBe('0.00%'); + expect(getFormatFromId(11, 'fr-CH')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'fr-CH')).toBe('# ?/?'); + expect(getFormatFromId(13, 'fr-CH')).toBe('# ??/??'); + expect(getFormatFromId(14, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'fr-CH')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'fr-CH')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'fr-CH')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'fr-CH')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'fr-CH')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'fr-CH')).toBe('hh:mm'); + expect(getFormatFromId(21, 'fr-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'fr-CH')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'fr-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'fr-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'fr-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'fr-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'fr-CH')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'fr-CH')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'fr-CH')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'fr-CH')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'fr-CH')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'fr-CH')).toBe('_-* #,##0 "CHF"_-;-* #,##0 "CHF"_-;_-* "-" "CHF"_-;_-@_-'); + expect(getFormatFromId(43, 'fr-CH')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'fr-CH')).toBe('_-* #,##0.00 "CHF"_-;-* #,##0.00 "CHF"_-;_-* "-"?? "CHF"_-;_-@_-'); + expect(getFormatFromId(45, 'fr-CH')).toBe('mm:ss'); + expect(getFormatFromId(46, 'fr-CH')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'fr-CH')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'fr-CH')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'fr-CH')).toBe('@'); + expect(getFormatFromId(50, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'fr-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'fr-CH')).toBe('dd.mm.yyyy'); + }); + test('fr-FR', () => { + expect(getFormatFromId(1, 'fr-FR')).toBe('0'); + expect(getFormatFromId(2, 'fr-FR')).toBe('0.00'); + expect(getFormatFromId(3, 'fr-FR')).toBe('#,##0'); + expect(getFormatFromId(4, 'fr-FR')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'fr-FR')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'fr-FR')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'fr-FR')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'fr-FR')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'fr-FR')).toBe('0%'); + expect(getFormatFromId(10, 'fr-FR')).toBe('0.00%'); + expect(getFormatFromId(11, 'fr-FR')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'fr-FR')).toBe('# ?/?'); + expect(getFormatFromId(13, 'fr-FR')).toBe('# ??/??'); + expect(getFormatFromId(14, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'fr-FR')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'fr-FR')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'fr-FR')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'fr-FR')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'fr-FR')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'fr-FR')).toBe('hh:mm'); + expect(getFormatFromId(21, 'fr-FR')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'fr-FR')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'fr-FR')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'fr-FR')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'fr-FR')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'fr-FR')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'fr-FR')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'fr-FR')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'fr-FR')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'fr-FR')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'fr-FR')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'fr-FR')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'fr-FR')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'fr-FR')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'fr-FR')).toBe('mm:ss'); + expect(getFormatFromId(46, 'fr-FR')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'fr-FR')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'fr-FR')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'fr-FR')).toBe('@'); + expect(getFormatFromId(50, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'fr-FR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'fr-FR')).toBe('dd/mm/yyyy'); + }); + test('gu-IN', () => { + expect(getFormatFromId(1, 'gu-IN')).toBe('0'); + expect(getFormatFromId(2, 'gu-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'gu-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'gu-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'gu-IN')).toBe('₹#,##0;₹-#,##0'); + expect(getFormatFromId(6, 'gu-IN')).toBe('₹#,##0;[Red]₹-#,##0'); + expect(getFormatFromId(7, 'gu-IN')).toBe('₹#,##0.00;₹-#,##0.00'); + expect(getFormatFromId(8, 'gu-IN')).toBe('₹#,##0.00;[Red]₹-#,##0.00'); + expect(getFormatFromId(9, 'gu-IN')).toBe('0%'); + expect(getFormatFromId(10, 'gu-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'gu-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'gu-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'gu-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(15, 'gu-IN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'gu-IN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'gu-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'gu-IN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'gu-IN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'gu-IN')).toBe('hh:mm'); + expect(getFormatFromId(21, 'gu-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'gu-IN')).toBe('dd-mm-yy hh:mm'); + expect(getFormatFromId(27, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(28, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(29, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(30, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(31, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(32, 'gu-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'gu-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'gu-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'gu-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(37, 'gu-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'gu-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'gu-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'gu-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'gu-IN')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'gu-IN')).toBe('_ ₹* #,##0_ ;_ ₹* -#,##0_ ;_ ₹* "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'gu-IN')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'gu-IN')).toBe('_ ₹* #,##0.00_ ;_ ₹* -#,##0.00_ ;_ ₹* "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'gu-IN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'gu-IN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'gu-IN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'gu-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'gu-IN')).toBe('@'); + expect(getFormatFromId(50, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(51, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(52, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(53, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(54, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(55, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(56, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(57, 'gu-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(58, 'gu-IN')).toBe('dd-mm-yy'); + }); + test('he-IL', () => { + expect(getFormatFromId(1, 'he-IL')).toBe('0'); + expect(getFormatFromId(2, 'he-IL')).toBe('0.00'); + expect(getFormatFromId(3, 'he-IL')).toBe('#,##0'); + expect(getFormatFromId(4, 'he-IL')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'he-IL')).toBe('₪ #,##0;₪ -#,##0'); + expect(getFormatFromId(6, 'he-IL')).toBe('₪ #,##0;[Red]₪ -#,##0'); + expect(getFormatFromId(7, 'he-IL')).toBe('₪ #,##0.00;₪ -#,##0.00'); + expect(getFormatFromId(8, 'he-IL')).toBe('₪ #,##0.00;[Red]₪ -#,##0.00'); + expect(getFormatFromId(9, 'he-IL')).toBe('0%'); + expect(getFormatFromId(10, 'he-IL')).toBe('0.00%'); + expect(getFormatFromId(11, 'he-IL')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'he-IL')).toBe('# ?/?'); + expect(getFormatFromId(13, 'he-IL')).toBe('# ??/??'); + expect(getFormatFromId(14, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'he-IL')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'he-IL')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'he-IL')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'he-IL')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'he-IL')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'he-IL')).toBe('hh:mm'); + expect(getFormatFromId(21, 'he-IL')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'he-IL')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'he-IL')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'he-IL')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'he-IL')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'he-IL')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'he-IL')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'he-IL')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'he-IL')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'he-IL')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'he-IL')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'he-IL')).toBe('_ ₪ * #,##0_ ;_ ₪ * -#,##0_ ;_ ₪ * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'he-IL')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'he-IL')).toBe('_ ₪ * #,##0.00_ ;_ ₪ * -#,##0.00_ ;_ ₪ * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'he-IL')).toBe('mm:ss'); + expect(getFormatFromId(46, 'he-IL')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'he-IL')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'he-IL')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'he-IL')).toBe('@'); + expect(getFormatFromId(50, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'he-IL')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'he-IL')).toBe('dd/mm/yyyy'); + }); + test('hi-IN', () => { + expect(getFormatFromId(1, 'hi-IN')).toBe('0'); + expect(getFormatFromId(2, 'hi-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'hi-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'hi-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'hi-IN')).toBe('₹#,##0;₹-#,##0'); + expect(getFormatFromId(6, 'hi-IN')).toBe('₹#,##0;[Red]₹-#,##0'); + expect(getFormatFromId(7, 'hi-IN')).toBe('₹#,##0.00;₹-#,##0.00'); + expect(getFormatFromId(8, 'hi-IN')).toBe('₹#,##0.00;[Red]₹-#,##0.00'); + expect(getFormatFromId(9, 'hi-IN')).toBe('0%'); + expect(getFormatFromId(10, 'hi-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'hi-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'hi-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'hi-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(15, 'hi-IN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'hi-IN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'hi-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'hi-IN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'hi-IN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'hi-IN')).toBe('hh:mm'); + expect(getFormatFromId(21, 'hi-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'hi-IN')).toBe('dd-mm-yyyy hh:mm'); + expect(getFormatFromId(27, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(28, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(29, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(30, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(31, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(32, 'hi-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'hi-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'hi-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'hi-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(37, 'hi-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'hi-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'hi-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'hi-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'hi-IN')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'hi-IN')).toBe('_ ₹* #,##0_ ;_ ₹* -#,##0_ ;_ ₹* "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'hi-IN')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'hi-IN')).toBe('_ ₹* #,##0.00_ ;_ ₹* -#,##0.00_ ;_ ₹* "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'hi-IN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'hi-IN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'hi-IN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'hi-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'hi-IN')).toBe('@'); + expect(getFormatFromId(50, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(51, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(52, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(53, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(54, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(55, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(56, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(57, 'hi-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(58, 'hi-IN')).toBe('dd-mm-yyyy'); + }); + test('hr-HR', () => { + expect(getFormatFromId(1, 'hr-HR')).toBe('0'); + expect(getFormatFromId(2, 'hr-HR')).toBe('0.00'); + expect(getFormatFromId(3, 'hr-HR')).toBe('#,##0'); + expect(getFormatFromId(4, 'hr-HR')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'hr-HR')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'hr-HR')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'hr-HR')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'hr-HR')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'hr-HR')).toBe('0%'); + expect(getFormatFromId(10, 'hr-HR')).toBe('0.00%'); + expect(getFormatFromId(11, 'hr-HR')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'hr-HR')).toBe('# ?/?'); + expect(getFormatFromId(13, 'hr-HR')).toBe('# ??/??'); + expect(getFormatFromId(14, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(15, 'hr-HR')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'hr-HR')).toBe('d.mmm'); + expect(getFormatFromId(17, 'hr-HR')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'hr-HR')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'hr-HR')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'hr-HR')).toBe('h:mm'); + expect(getFormatFromId(21, 'hr-HR')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'hr-HR')).toBe('d.m.yyyy h:mm'); + expect(getFormatFromId(27, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(28, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(29, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(30, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(31, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(32, 'hr-HR')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'hr-HR')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'hr-HR')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'hr-HR')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(37, 'hr-HR')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'hr-HR')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'hr-HR')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'hr-HR')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'hr-HR')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'hr-HR')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'hr-HR')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'hr-HR')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'hr-HR')).toBe('mm:ss'); + expect(getFormatFromId(46, 'hr-HR')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'hr-HR')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'hr-HR')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'hr-HR')).toBe('@'); + expect(getFormatFromId(50, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(51, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(52, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(53, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(54, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(55, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(56, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(57, 'hr-HR')).toBe('d.m.yyyy'); + expect(getFormatFromId(58, 'hr-HR')).toBe('d.m.yyyy'); + }); + test('hu-HU', () => { + expect(getFormatFromId(1, 'hu-HU')).toBe('0'); + expect(getFormatFromId(2, 'hu-HU')).toBe('0.00'); + expect(getFormatFromId(3, 'hu-HU')).toBe('#,##0'); + expect(getFormatFromId(4, 'hu-HU')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'hu-HU')).toBe('#,##0 "Ft";-#,##0 "Ft"'); + expect(getFormatFromId(6, 'hu-HU')).toBe('#,##0 "Ft";[Red]-#,##0 "Ft"'); + expect(getFormatFromId(7, 'hu-HU')).toBe('#,##0.00 "Ft";-#,##0.00 "Ft"'); + expect(getFormatFromId(8, 'hu-HU')).toBe('#,##0.00 "Ft";[Red]-#,##0.00 "Ft"'); + expect(getFormatFromId(9, 'hu-HU')).toBe('0%'); + expect(getFormatFromId(10, 'hu-HU')).toBe('0.00%'); + expect(getFormatFromId(11, 'hu-HU')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'hu-HU')).toBe('# ?/?'); + expect(getFormatFromId(13, 'hu-HU')).toBe('# ??/??'); + expect(getFormatFromId(14, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(15, 'hu-HU')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'hu-HU')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'hu-HU')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'hu-HU')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'hu-HU')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'hu-HU')).toBe('h:mm'); + expect(getFormatFromId(21, 'hu-HU')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'hu-HU')).toBe('yyyy.mm.dd h:mm'); + expect(getFormatFromId(27, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(28, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(29, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(30, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(31, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(32, 'hu-HU')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'hu-HU')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'hu-HU')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'hu-HU')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(37, 'hu-HU')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'hu-HU')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'hu-HU')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'hu-HU')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'hu-HU')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'hu-HU')).toBe('_-* #,##0 "Ft"_-;-* #,##0 "Ft"_-;_-* "-" "Ft"_-;_-@_-'); + expect(getFormatFromId(43, 'hu-HU')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'hu-HU')).toBe('_-* #,##0.00 "Ft"_-;-* #,##0.00 "Ft"_-;_-* "-"?? "Ft"_-;_-@_-'); + expect(getFormatFromId(45, 'hu-HU')).toBe('mm:ss'); + expect(getFormatFromId(46, 'hu-HU')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'hu-HU')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'hu-HU')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'hu-HU')).toBe('@'); + expect(getFormatFromId(50, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(51, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(52, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(53, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(54, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(55, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(56, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(57, 'hu-HU')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(58, 'hu-HU')).toBe('yyyy.mm.dd'); + }); + test('hy-AM', () => { + expect(getFormatFromId(1, 'hy-AM')).toBe('0'); + expect(getFormatFromId(2, 'hy-AM')).toBe('0.00'); + expect(getFormatFromId(3, 'hy-AM')).toBe('#,##0'); + expect(getFormatFromId(4, 'hy-AM')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'hy-AM')).toBe('#,##0 ֏;-#,##0 ֏'); + expect(getFormatFromId(6, 'hy-AM')).toBe('#,##0 ֏;[Red]-#,##0 ֏'); + expect(getFormatFromId(7, 'hy-AM')).toBe('#,##0.00 ֏;-#,##0.00 ֏'); + expect(getFormatFromId(8, 'hy-AM')).toBe('#,##0.00 ֏;[Red]-#,##0.00 ֏'); + expect(getFormatFromId(9, 'hy-AM')).toBe('0%'); + expect(getFormatFromId(10, 'hy-AM')).toBe('0.00%'); + expect(getFormatFromId(11, 'hy-AM')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'hy-AM')).toBe('# ?/?'); + expect(getFormatFromId(13, 'hy-AM')).toBe('# ??/??'); + expect(getFormatFromId(14, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'hy-AM')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'hy-AM')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'hy-AM')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'hy-AM')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'hy-AM')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'hy-AM')).toBe('hh:mm'); + expect(getFormatFromId(21, 'hy-AM')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'hy-AM')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'hy-AM')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'hy-AM')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'hy-AM')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'hy-AM')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'hy-AM')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'hy-AM')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'hy-AM')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'hy-AM')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'hy-AM')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'hy-AM')).toBe('_-* #,##0 ֏_-;-* #,##0 ֏_-;_-* "-" ֏_-;_-@_-'); + expect(getFormatFromId(43, 'hy-AM')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'hy-AM')).toBe('_-* #,##0.00 ֏_-;-* #,##0.00 ֏_-;_-* "-"?? ֏_-;_-@_-'); + expect(getFormatFromId(45, 'hy-AM')).toBe('mm:ss'); + expect(getFormatFromId(46, 'hy-AM')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'hy-AM')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'hy-AM')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'hy-AM')).toBe('@'); + expect(getFormatFromId(50, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'hy-AM')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'hy-AM')).toBe('dd.mm.yyyy'); + }); + test('id-ID', () => { + expect(getFormatFromId(1, 'id-ID')).toBe('0'); + expect(getFormatFromId(2, 'id-ID')).toBe('0.00'); + expect(getFormatFromId(3, 'id-ID')).toBe('#,##0'); + expect(getFormatFromId(4, 'id-ID')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'id-ID')).toBe('"Rp"#,##0;-"Rp"#,##0'); + expect(getFormatFromId(6, 'id-ID')).toBe('"Rp"#,##0;[Red]-"Rp"#,##0'); + expect(getFormatFromId(7, 'id-ID')).toBe('"Rp"#,##0.00;-"Rp"#,##0.00'); + expect(getFormatFromId(8, 'id-ID')).toBe('"Rp"#,##0.00;[Red]-"Rp"#,##0.00'); + expect(getFormatFromId(9, 'id-ID')).toBe('0%'); + expect(getFormatFromId(10, 'id-ID')).toBe('0.00%'); + expect(getFormatFromId(11, 'id-ID')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'id-ID')).toBe('# ?/?'); + expect(getFormatFromId(13, 'id-ID')).toBe('# ??/??'); + expect(getFormatFromId(14, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'id-ID')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'id-ID')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'id-ID')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'id-ID')).toBe('h.mm AM/PM'); + expect(getFormatFromId(19, 'id-ID')).toBe('h.mm.ss AM/PM'); + expect(getFormatFromId(20, 'id-ID')).toBe('hh.mm'); + expect(getFormatFromId(21, 'id-ID')).toBe('hh.mm.ss'); + expect(getFormatFromId(22, 'id-ID')).toBe('dd/mm/yyyy hh.mm'); + expect(getFormatFromId(27, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'id-ID')).toBe('hh.mm.ss'); + expect(getFormatFromId(33, 'id-ID')).toBe('hh.mm.ss'); + expect(getFormatFromId(34, 'id-ID')).toBe('hh.mm.ss'); + expect(getFormatFromId(35, 'id-ID')).toBe('hh.mm.ss'); + expect(getFormatFromId(36, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'id-ID')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'id-ID')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'id-ID')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'id-ID')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'id-ID')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'id-ID')).toBe('_-"Rp"* #,##0_-;-"Rp"* #,##0_-;_-"Rp"* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'id-ID')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'id-ID')).toBe('_-"Rp"* #,##0.00_-;-"Rp"* #,##0.00_-;_-"Rp"* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'id-ID')).toBe('mm.ss'); + expect(getFormatFromId(46, 'id-ID')).toBe('[h].mm.ss'); + expect(getFormatFromId(47, 'id-ID')).toBe('mm.ss.0'); + expect(getFormatFromId(48, 'id-ID')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'id-ID')).toBe('@'); + expect(getFormatFromId(50, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'id-ID')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'id-ID')).toBe('dd/mm/yyyy'); + }); + test('is-IS', () => { + expect(getFormatFromId(1, 'is-IS')).toBe('0'); + expect(getFormatFromId(2, 'is-IS')).toBe('0.00'); + expect(getFormatFromId(3, 'is-IS')).toBe('#,##0'); + expect(getFormatFromId(4, 'is-IS')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'is-IS')).toBe('#,##0 "kr.";-#,##0 "kr."'); + expect(getFormatFromId(6, 'is-IS')).toBe('#,##0 "kr.";[Red]-#,##0 "kr."'); + expect(getFormatFromId(7, 'is-IS')).toBe('#,##0.00 "kr.";-#,##0.00 "kr."'); + expect(getFormatFromId(8, 'is-IS')).toBe('#,##0.00 "kr.";[Red]-#,##0.00 "kr."'); + expect(getFormatFromId(9, 'is-IS')).toBe('0%'); + expect(getFormatFromId(10, 'is-IS')).toBe('0.00%'); + expect(getFormatFromId(11, 'is-IS')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'is-IS')).toBe('# ?/?'); + expect(getFormatFromId(13, 'is-IS')).toBe('# ??/??'); + expect(getFormatFromId(14, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(15, 'is-IS')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'is-IS')).toBe('d.mmm'); + expect(getFormatFromId(17, 'is-IS')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'is-IS')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'is-IS')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'is-IS')).toBe('hh:mm'); + expect(getFormatFromId(21, 'is-IS')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'is-IS')).toBe('d.m.yyyy hh:mm'); + expect(getFormatFromId(27, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(28, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(29, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(30, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(31, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(32, 'is-IS')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'is-IS')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'is-IS')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'is-IS')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(37, 'is-IS')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'is-IS')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'is-IS')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'is-IS')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'is-IS')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'is-IS')).toBe('_-* #,##0 "kr."_-;-* #,##0 "kr."_-;_-* "-" "kr."_-;_-@_-'); + expect(getFormatFromId(43, 'is-IS')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'is-IS')).toBe('_-* #,##0.00 "kr."_-;-* #,##0.00 "kr."_-;_-* "-"?? "kr."_-;_-@_-'); + expect(getFormatFromId(45, 'is-IS')).toBe('mm:ss'); + expect(getFormatFromId(46, 'is-IS')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'is-IS')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'is-IS')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'is-IS')).toBe('@'); + expect(getFormatFromId(50, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(51, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(52, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(53, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(54, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(55, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(56, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(57, 'is-IS')).toBe('d.m.yyyy'); + expect(getFormatFromId(58, 'is-IS')).toBe('d.m.yyyy'); + }); + test('it-CH', () => { + expect(getFormatFromId(1, 'it-CH')).toBe('0'); + expect(getFormatFromId(2, 'it-CH')).toBe('0.00'); + expect(getFormatFromId(3, 'it-CH')).toBe('#,##0'); + expect(getFormatFromId(4, 'it-CH')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'it-CH')).toBe('"CHF" #,##0;"CHF" -#,##0'); + expect(getFormatFromId(6, 'it-CH')).toBe('"CHF" #,##0;[Red]"CHF" -#,##0'); + expect(getFormatFromId(7, 'it-CH')).toBe('"CHF" #,##0.00;"CHF" -#,##0.00'); + expect(getFormatFromId(8, 'it-CH')).toBe('"CHF" #,##0.00;[Red]"CHF" -#,##0.00'); + expect(getFormatFromId(9, 'it-CH')).toBe('0%'); + expect(getFormatFromId(10, 'it-CH')).toBe('0.00%'); + expect(getFormatFromId(11, 'it-CH')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'it-CH')).toBe('# ?/?'); + expect(getFormatFromId(13, 'it-CH')).toBe('# ??/??'); + expect(getFormatFromId(14, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'it-CH')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'it-CH')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'it-CH')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'it-CH')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'it-CH')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'it-CH')).toBe('hh:mm'); + expect(getFormatFromId(21, 'it-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'it-CH')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'it-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'it-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'it-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'it-CH')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'it-CH')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'it-CH')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'it-CH')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'it-CH')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'it-CH')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'it-CH')).toBe('_ "CHF" * #,##0_ ;_ "CHF" * -#,##0_ ;_ "CHF" * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'it-CH')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'it-CH')).toBe('_ "CHF" * #,##0.00_ ;_ "CHF" * -#,##0.00_ ;_ "CHF" * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'it-CH')).toBe('mm:ss'); + expect(getFormatFromId(46, 'it-CH')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'it-CH')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'it-CH')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'it-CH')).toBe('@'); + expect(getFormatFromId(50, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'it-CH')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'it-CH')).toBe('dd.mm.yyyy'); + }); + test('it-IT', () => { + expect(getFormatFromId(1, 'it-IT')).toBe('0'); + expect(getFormatFromId(2, 'it-IT')).toBe('0.00'); + expect(getFormatFromId(3, 'it-IT')).toBe('#,##0'); + expect(getFormatFromId(4, 'it-IT')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'it-IT')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'it-IT')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'it-IT')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'it-IT')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'it-IT')).toBe('0%'); + expect(getFormatFromId(10, 'it-IT')).toBe('0.00%'); + expect(getFormatFromId(11, 'it-IT')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'it-IT')).toBe('# ?/?'); + expect(getFormatFromId(13, 'it-IT')).toBe('# ??/??'); + expect(getFormatFromId(14, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'it-IT')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'it-IT')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'it-IT')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'it-IT')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'it-IT')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'it-IT')).toBe('hh:mm'); + expect(getFormatFromId(21, 'it-IT')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'it-IT')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'it-IT')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'it-IT')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'it-IT')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'it-IT')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'it-IT')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'it-IT')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'it-IT')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'it-IT')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'it-IT')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'it-IT')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'it-IT')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'it-IT')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'it-IT')).toBe('mm:ss'); + expect(getFormatFromId(46, 'it-IT')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'it-IT')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'it-IT')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'it-IT')).toBe('@'); + expect(getFormatFromId(50, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'it-IT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'it-IT')).toBe('dd/mm/yyyy'); + }); + test('ja-JP', () => { + expect(getFormatFromId(1, 'ja-JP')).toBe('0'); + expect(getFormatFromId(2, 'ja-JP')).toBe('0.00'); + expect(getFormatFromId(3, 'ja-JP')).toBe('#,##0'); + expect(getFormatFromId(4, 'ja-JP')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ja-JP')).toBe('¥#,##0;-¥#,##0'); + expect(getFormatFromId(6, 'ja-JP')).toBe('¥#,##0;[Red]-¥#,##0'); + expect(getFormatFromId(7, 'ja-JP')).toBe('¥#,##0.00;-¥#,##0.00'); + expect(getFormatFromId(8, 'ja-JP')).toBe('¥#,##0.00;[Red]-¥#,##0.00'); + expect(getFormatFromId(9, 'ja-JP')).toBe('0%'); + expect(getFormatFromId(10, 'ja-JP')).toBe('0.00%'); + expect(getFormatFromId(11, 'ja-JP')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ja-JP')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ja-JP')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(15, 'ja-JP')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'ja-JP')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'ja-JP')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'ja-JP')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'ja-JP')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ja-JP')).toBe('h:mm'); + expect(getFormatFromId(21, 'ja-JP')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'ja-JP')).toBe('yyyy/mm/dd h:mm'); + expect(getFormatFromId(27, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(28, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(29, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(30, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(31, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(32, 'ja-JP')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'ja-JP')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'ja-JP')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'ja-JP')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(37, 'ja-JP')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ja-JP')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ja-JP')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ja-JP')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ja-JP')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'ja-JP')).toBe('_-¥* #,##0_-;-¥* #,##0_-;_-¥* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'ja-JP')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'ja-JP')).toBe('_-¥* #,##0.00_-;-¥* #,##0.00_-;_-¥* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'ja-JP')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ja-JP')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ja-JP')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ja-JP')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ja-JP')).toBe('@'); + expect(getFormatFromId(50, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(51, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(52, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(53, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(54, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(55, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(56, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(57, 'ja-JP')).toBe('yyyy/mm/dd'); + expect(getFormatFromId(58, 'ja-JP')).toBe('yyyy/mm/dd'); + }); + test('ka-GE', () => { + expect(getFormatFromId(1, 'ka-GE')).toBe('0'); + expect(getFormatFromId(2, 'ka-GE')).toBe('0.00'); + expect(getFormatFromId(3, 'ka-GE')).toBe('#,##0'); + expect(getFormatFromId(4, 'ka-GE')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ka-GE')).toBe('#,##0 ₾;-#,##0 ₾'); + expect(getFormatFromId(6, 'ka-GE')).toBe('#,##0 ₾;[Red]-#,##0 ₾'); + expect(getFormatFromId(7, 'ka-GE')).toBe('#,##0.00 ₾;-#,##0.00 ₾'); + expect(getFormatFromId(8, 'ka-GE')).toBe('#,##0.00 ₾;[Red]-#,##0.00 ₾'); + expect(getFormatFromId(9, 'ka-GE')).toBe('0%'); + expect(getFormatFromId(10, 'ka-GE')).toBe('0.00%'); + expect(getFormatFromId(11, 'ka-GE')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ka-GE')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ka-GE')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'ka-GE')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'ka-GE')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'ka-GE')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'ka-GE')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'ka-GE')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ka-GE')).toBe('hh:mm'); + expect(getFormatFromId(21, 'ka-GE')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'ka-GE')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'ka-GE')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'ka-GE')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'ka-GE')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'ka-GE')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'ka-GE')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ka-GE')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ka-GE')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ka-GE')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ka-GE')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'ka-GE')).toBe('_-* #,##0 ₾_-;-* #,##0 ₾_-;_-* "-" ₾_-;_-@_-'); + expect(getFormatFromId(43, 'ka-GE')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'ka-GE')).toBe('_-* #,##0.00 ₾_-;-* #,##0.00 ₾_-;_-* "-"?? ₾_-;_-@_-'); + expect(getFormatFromId(45, 'ka-GE')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ka-GE')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ka-GE')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ka-GE')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ka-GE')).toBe('@'); + expect(getFormatFromId(50, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'ka-GE')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'ka-GE')).toBe('dd.mm.yyyy'); + }); + test('kk-KZ', () => { + expect(getFormatFromId(1, 'kk-KZ')).toBe('0'); + expect(getFormatFromId(2, 'kk-KZ')).toBe('0.00'); + expect(getFormatFromId(3, 'kk-KZ')).toBe('#,##0'); + expect(getFormatFromId(4, 'kk-KZ')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'kk-KZ')).toBe('#,##0 ₸;-#,##0 ₸'); + expect(getFormatFromId(6, 'kk-KZ')).toBe('#,##0 ₸;[Red]-#,##0 ₸'); + expect(getFormatFromId(7, 'kk-KZ')).toBe('#,##0.00 ₸;-#,##0.00 ₸'); + expect(getFormatFromId(8, 'kk-KZ')).toBe('#,##0.00 ₸;[Red]-#,##0.00 ₸'); + expect(getFormatFromId(9, 'kk-KZ')).toBe('0%'); + expect(getFormatFromId(10, 'kk-KZ')).toBe('0.00%'); + expect(getFormatFromId(11, 'kk-KZ')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'kk-KZ')).toBe('# ?/?'); + expect(getFormatFromId(13, 'kk-KZ')).toBe('# ??/??'); + expect(getFormatFromId(14, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'kk-KZ')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'kk-KZ')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'kk-KZ')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'kk-KZ')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'kk-KZ')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'kk-KZ')).toBe('hh:mm'); + expect(getFormatFromId(21, 'kk-KZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'kk-KZ')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'kk-KZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'kk-KZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'kk-KZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'kk-KZ')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'kk-KZ')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'kk-KZ')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'kk-KZ')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'kk-KZ')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'kk-KZ')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'kk-KZ')).toBe('_-* #,##0 ₸_-;-* #,##0 ₸_-;_-* "-" ₸_-;_-@_-'); + expect(getFormatFromId(43, 'kk-KZ')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'kk-KZ')).toBe('_-* #,##0.00 ₸_-;-* #,##0.00 ₸_-;_-* "-"?? ₸_-;_-@_-'); + expect(getFormatFromId(45, 'kk-KZ')).toBe('mm:ss'); + expect(getFormatFromId(46, 'kk-KZ')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'kk-KZ')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'kk-KZ')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'kk-KZ')).toBe('@'); + expect(getFormatFromId(50, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'kk-KZ')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'kk-KZ')).toBe('dd.mm.yyyy'); + }); + test('kn-IN', () => { + expect(getFormatFromId(1, 'kn-IN')).toBe('0'); + expect(getFormatFromId(2, 'kn-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'kn-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'kn-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'kn-IN')).toBe('₹#,##0;₹-#,##0'); + expect(getFormatFromId(6, 'kn-IN')).toBe('₹#,##0;[Red]₹-#,##0'); + expect(getFormatFromId(7, 'kn-IN')).toBe('₹#,##0.00;₹-#,##0.00'); + expect(getFormatFromId(8, 'kn-IN')).toBe('₹#,##0.00;[Red]₹-#,##0.00'); + expect(getFormatFromId(9, 'kn-IN')).toBe('0%'); + expect(getFormatFromId(10, 'kn-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'kn-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'kn-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'kn-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(15, 'kn-IN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'kn-IN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'kn-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'kn-IN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'kn-IN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'kn-IN')).toBe('hh:mm'); + expect(getFormatFromId(21, 'kn-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'kn-IN')).toBe('dd-mm-yy hh:mm'); + expect(getFormatFromId(27, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(28, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(29, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(30, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(31, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(32, 'kn-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'kn-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'kn-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'kn-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(37, 'kn-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'kn-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'kn-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'kn-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'kn-IN')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'kn-IN')).toBe('_ ₹* #,##0_ ;_ ₹* -#,##0_ ;_ ₹* "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'kn-IN')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'kn-IN')).toBe('_ ₹* #,##0.00_ ;_ ₹* -#,##0.00_ ;_ ₹* "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'kn-IN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'kn-IN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'kn-IN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'kn-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'kn-IN')).toBe('@'); + expect(getFormatFromId(50, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(51, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(52, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(53, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(54, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(55, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(56, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(57, 'kn-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(58, 'kn-IN')).toBe('dd-mm-yy'); + }); + test('ko-KR', () => { + expect(getFormatFromId(1, 'ko-KR')).toBe('0'); + expect(getFormatFromId(2, 'ko-KR')).toBe('0.00'); + expect(getFormatFromId(3, 'ko-KR')).toBe('#,##0'); + expect(getFormatFromId(4, 'ko-KR')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ko-KR')).toBe('₩#,##0;-₩#,##0'); + expect(getFormatFromId(6, 'ko-KR')).toBe('₩#,##0;[Red]-₩#,##0'); + expect(getFormatFromId(7, 'ko-KR')).toBe('₩#,##0.00;-₩#,##0.00'); + expect(getFormatFromId(8, 'ko-KR')).toBe('₩#,##0.00;[Red]-₩#,##0.00'); + expect(getFormatFromId(9, 'ko-KR')).toBe('0%'); + expect(getFormatFromId(10, 'ko-KR')).toBe('0.00%'); + expect(getFormatFromId(11, 'ko-KR')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ko-KR')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ko-KR')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(15, 'ko-KR')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'ko-KR')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'ko-KR')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'ko-KR')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'ko-KR')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ko-KR')).toBe('h:mm'); + expect(getFormatFromId(21, 'ko-KR')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'ko-KR')).toBe('yyyy-mm-dd h:mm'); + expect(getFormatFromId(27, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(28, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(29, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(30, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(31, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(32, 'ko-KR')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'ko-KR')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'ko-KR')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'ko-KR')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(37, 'ko-KR')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ko-KR')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ko-KR')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ko-KR')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ko-KR')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'ko-KR')).toBe('_-₩* #,##0_-;-₩* #,##0_-;_-₩* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'ko-KR')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'ko-KR')).toBe('_-₩* #,##0.00_-;-₩* #,##0.00_-;_-₩* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'ko-KR')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ko-KR')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ko-KR')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ko-KR')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ko-KR')).toBe('@'); + expect(getFormatFromId(50, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(51, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(52, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(53, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(54, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(55, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(56, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(57, 'ko-KR')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(58, 'ko-KR')).toBe('yyyy-mm-dd'); + }); + test('lt-LT', () => { + expect(getFormatFromId(1, 'lt-LT')).toBe('0'); + expect(getFormatFromId(2, 'lt-LT')).toBe('0.00'); + expect(getFormatFromId(3, 'lt-LT')).toBe('#,##0'); + expect(getFormatFromId(4, 'lt-LT')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'lt-LT')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'lt-LT')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'lt-LT')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'lt-LT')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'lt-LT')).toBe('0%'); + expect(getFormatFromId(10, 'lt-LT')).toBe('0.00%'); + expect(getFormatFromId(11, 'lt-LT')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'lt-LT')).toBe('# ?/?'); + expect(getFormatFromId(13, 'lt-LT')).toBe('# ??/??'); + expect(getFormatFromId(14, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(15, 'lt-LT')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'lt-LT')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'lt-LT')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'lt-LT')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'lt-LT')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'lt-LT')).toBe('hh:mm'); + expect(getFormatFromId(21, 'lt-LT')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'lt-LT')).toBe('yyyy-mm-dd hh:mm'); + expect(getFormatFromId(27, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(28, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(29, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(30, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(31, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(32, 'lt-LT')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'lt-LT')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'lt-LT')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'lt-LT')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(37, 'lt-LT')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'lt-LT')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'lt-LT')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'lt-LT')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'lt-LT')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'lt-LT')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'lt-LT')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'lt-LT')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'lt-LT')).toBe('mm:ss'); + expect(getFormatFromId(46, 'lt-LT')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'lt-LT')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'lt-LT')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'lt-LT')).toBe('@'); + expect(getFormatFromId(50, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(51, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(52, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(53, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(54, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(55, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(56, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(57, 'lt-LT')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(58, 'lt-LT')).toBe('yyyy-mm-dd'); + }); + test('lv-LV', () => { + expect(getFormatFromId(1, 'lv-LV')).toBe('0'); + expect(getFormatFromId(2, 'lv-LV')).toBe('0.00'); + expect(getFormatFromId(3, 'lv-LV')).toBe('#,##0'); + expect(getFormatFromId(4, 'lv-LV')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'lv-LV')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'lv-LV')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'lv-LV')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'lv-LV')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'lv-LV')).toBe('0%'); + expect(getFormatFromId(10, 'lv-LV')).toBe('0.00%'); + expect(getFormatFromId(11, 'lv-LV')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'lv-LV')).toBe('# ?/?'); + expect(getFormatFromId(13, 'lv-LV')).toBe('# ??/??'); + expect(getFormatFromId(14, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'lv-LV')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'lv-LV')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'lv-LV')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'lv-LV')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'lv-LV')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'lv-LV')).toBe('hh:mm'); + expect(getFormatFromId(21, 'lv-LV')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'lv-LV')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'lv-LV')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'lv-LV')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'lv-LV')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'lv-LV')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'lv-LV')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'lv-LV')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'lv-LV')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'lv-LV')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'lv-LV')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'lv-LV')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'lv-LV')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'lv-LV')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'lv-LV')).toBe('mm:ss'); + expect(getFormatFromId(46, 'lv-LV')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'lv-LV')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'lv-LV')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'lv-LV')).toBe('@'); + expect(getFormatFromId(50, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'lv-LV')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'lv-LV')).toBe('dd.mm.yyyy'); + }); + test('ml-IN', () => { + expect(getFormatFromId(1, 'ml-IN')).toBe('0'); + expect(getFormatFromId(2, 'ml-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'ml-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'ml-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ml-IN')).toBe('₹#,##0;-₹#,##0'); + expect(getFormatFromId(6, 'ml-IN')).toBe('₹#,##0;[Red]-₹#,##0'); + expect(getFormatFromId(7, 'ml-IN')).toBe('₹#,##0.00;-₹#,##0.00'); + expect(getFormatFromId(8, 'ml-IN')).toBe('₹#,##0.00;[Red]-₹#,##0.00'); + expect(getFormatFromId(9, 'ml-IN')).toBe('0%'); + expect(getFormatFromId(10, 'ml-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'ml-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ml-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ml-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'ml-IN')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'ml-IN')).toBe('d-mmm'); + expect(getFormatFromId(17, 'ml-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'ml-IN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'ml-IN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ml-IN')).toBe('h:mm'); + expect(getFormatFromId(21, 'ml-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'ml-IN')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'ml-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'ml-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'ml-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'ml-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'ml-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ml-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ml-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ml-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ml-IN')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'ml-IN')).toBe('_-₹* #,##0_-;-₹* #,##0_-;_-₹* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'ml-IN')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'ml-IN')).toBe('_-₹* #,##0.00_-;-₹* #,##0.00_-;_-₹* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'ml-IN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ml-IN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ml-IN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ml-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ml-IN')).toBe('@'); + expect(getFormatFromId(50, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'ml-IN')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'ml-IN')).toBe('d/m/yyyy'); + }); + test('mn-MN', () => { + expect(getFormatFromId(1, 'mn-MN')).toBe('0'); + expect(getFormatFromId(2, 'mn-MN')).toBe('0.00'); + expect(getFormatFromId(3, 'mn-MN')).toBe('#,##0'); + expect(getFormatFromId(4, 'mn-MN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'mn-MN')).toBe('₮ #,##0;-₮ #,##0'); + expect(getFormatFromId(6, 'mn-MN')).toBe('₮ #,##0;[Red]-₮ #,##0'); + expect(getFormatFromId(7, 'mn-MN')).toBe('₮ #,##0.00;-₮ #,##0.00'); + expect(getFormatFromId(8, 'mn-MN')).toBe('₮ #,##0.00;[Red]-₮ #,##0.00'); + expect(getFormatFromId(9, 'mn-MN')).toBe('0%'); + expect(getFormatFromId(10, 'mn-MN')).toBe('0.00%'); + expect(getFormatFromId(11, 'mn-MN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'mn-MN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'mn-MN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(15, 'mn-MN')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'mn-MN')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'mn-MN')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'mn-MN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'mn-MN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'mn-MN')).toBe('hh:mm'); + expect(getFormatFromId(21, 'mn-MN')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'mn-MN')).toBe('yyyy.mm.dd hh:mm'); + expect(getFormatFromId(27, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(28, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(29, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(30, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(31, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(32, 'mn-MN')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'mn-MN')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'mn-MN')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'mn-MN')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(37, 'mn-MN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'mn-MN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'mn-MN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'mn-MN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'mn-MN')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'mn-MN')).toBe('_-₮ * #,##0_-;-₮ * #,##0_-;_-₮ * "-"_-;_-@_-'); + expect(getFormatFromId(43, 'mn-MN')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'mn-MN')).toBe('_-₮ * #,##0.00_-;-₮ * #,##0.00_-;_-₮ * "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'mn-MN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'mn-MN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'mn-MN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'mn-MN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'mn-MN')).toBe('@'); + expect(getFormatFromId(50, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(51, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(52, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(53, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(54, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(55, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(56, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(57, 'mn-MN')).toBe('yyyy.mm.dd'); + expect(getFormatFromId(58, 'mn-MN')).toBe('yyyy.mm.dd'); + }); + test('mr-IN', () => { + expect(getFormatFromId(1, 'mr-IN')).toBe('0'); + expect(getFormatFromId(2, 'mr-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'mr-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'mr-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'mr-IN')).toBe('₹#,##0;₹-#,##0'); + expect(getFormatFromId(6, 'mr-IN')).toBe('₹#,##0;[Red]₹-#,##0'); + expect(getFormatFromId(7, 'mr-IN')).toBe('₹#,##0.00;₹-#,##0.00'); + expect(getFormatFromId(8, 'mr-IN')).toBe('₹#,##0.00;[Red]₹-#,##0.00'); + expect(getFormatFromId(9, 'mr-IN')).toBe('0%'); + expect(getFormatFromId(10, 'mr-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'mr-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'mr-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'mr-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(15, 'mr-IN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'mr-IN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'mr-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'mr-IN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'mr-IN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'mr-IN')).toBe('hh:mm'); + expect(getFormatFromId(21, 'mr-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'mr-IN')).toBe('dd-mm-yyyy hh:mm'); + expect(getFormatFromId(27, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(28, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(29, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(30, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(31, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(32, 'mr-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'mr-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'mr-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'mr-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(37, 'mr-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'mr-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'mr-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'mr-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'mr-IN')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'mr-IN')).toBe('_ ₹* #,##0_ ;_ ₹* -#,##0_ ;_ ₹* "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'mr-IN')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'mr-IN')).toBe('_ ₹* #,##0.00_ ;_ ₹* -#,##0.00_ ;_ ₹* "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'mr-IN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'mr-IN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'mr-IN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'mr-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'mr-IN')).toBe('@'); + expect(getFormatFromId(50, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(51, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(52, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(53, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(54, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(55, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(56, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(57, 'mr-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(58, 'mr-IN')).toBe('dd-mm-yyyy'); + }); + test('my-MM', () => { + expect(getFormatFromId(1, 'my-MM')).toBe('0'); + expect(getFormatFromId(2, 'my-MM')).toBe('0.00'); + expect(getFormatFromId(3, 'my-MM')).toBe('#,##0'); + expect(getFormatFromId(4, 'my-MM')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'my-MM')).toBe('#,##0 "K";-#,##0 "K"'); + expect(getFormatFromId(6, 'my-MM')).toBe('#,##0 "K";[Red]-#,##0 "K"'); + expect(getFormatFromId(7, 'my-MM')).toBe('#,##0.00 "K";-#,##0.00 "K"'); + expect(getFormatFromId(8, 'my-MM')).toBe('#,##0.00 "K";[Red]-#,##0.00 "K"'); + expect(getFormatFromId(9, 'my-MM')).toBe('0%'); + expect(getFormatFromId(10, 'my-MM')).toBe('0.00%'); + expect(getFormatFromId(11, 'my-MM')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'my-MM')).toBe('# ?/?'); + expect(getFormatFromId(13, 'my-MM')).toBe('# ??/??'); + expect(getFormatFromId(14, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'my-MM')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'my-MM')).toBe('d-mmm'); + expect(getFormatFromId(17, 'my-MM')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'my-MM')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'my-MM')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'my-MM')).toBe('h:mm'); + expect(getFormatFromId(21, 'my-MM')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'my-MM')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'my-MM')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'my-MM')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'my-MM')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'my-MM')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'my-MM')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'my-MM')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'my-MM')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'my-MM')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'my-MM')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'my-MM')).toBe('_-* #,##0 "K"_-;-* #,##0 "K"_-;_-* "-" "K"_-;_-@_-'); + expect(getFormatFromId(43, 'my-MM')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'my-MM')).toBe('_-* #,##0.00 "K"_-;-* #,##0.00 "K"_-;_-* "-"?? "K"_-;_-@_-'); + expect(getFormatFromId(45, 'my-MM')).toBe('mm:ss'); + expect(getFormatFromId(46, 'my-MM')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'my-MM')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'my-MM')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'my-MM')).toBe('@'); + expect(getFormatFromId(50, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'my-MM')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'my-MM')).toBe('d/m/yyyy'); + }); + test('nb-NO', () => { + expect(getFormatFromId(1, 'nb-NO')).toBe('0'); + expect(getFormatFromId(2, 'nb-NO')).toBe('0.00'); + expect(getFormatFromId(3, 'nb-NO')).toBe('#,##0'); + expect(getFormatFromId(4, 'nb-NO')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'nb-NO')).toBe('"kr" #,##0;"kr" -#,##0'); + expect(getFormatFromId(6, 'nb-NO')).toBe('"kr" #,##0;[Red]"kr" -#,##0'); + expect(getFormatFromId(7, 'nb-NO')).toBe('"kr" #,##0.00;"kr" -#,##0.00'); + expect(getFormatFromId(8, 'nb-NO')).toBe('"kr" #,##0.00;[Red]"kr" -#,##0.00'); + expect(getFormatFromId(9, 'nb-NO')).toBe('0 %'); + expect(getFormatFromId(10, 'nb-NO')).toBe('0.00 %'); + expect(getFormatFromId(11, 'nb-NO')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'nb-NO')).toBe('# ?/?'); + expect(getFormatFromId(13, 'nb-NO')).toBe('# ??/??'); + expect(getFormatFromId(14, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'nb-NO')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'nb-NO')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'nb-NO')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'nb-NO')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'nb-NO')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'nb-NO')).toBe('hh:mm'); + expect(getFormatFromId(21, 'nb-NO')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'nb-NO')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'nb-NO')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'nb-NO')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'nb-NO')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'nb-NO')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'nb-NO')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'nb-NO')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'nb-NO')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'nb-NO')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'nb-NO')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'nb-NO')).toBe('_ "kr" * #,##0_ ;_ "kr" * -#,##0_ ;_ "kr" * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'nb-NO')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'nb-NO')).toBe('_ "kr" * #,##0.00_ ;_ "kr" * -#,##0.00_ ;_ "kr" * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'nb-NO')).toBe('mm:ss'); + expect(getFormatFromId(46, 'nb-NO')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'nb-NO')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'nb-NO')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'nb-NO')).toBe('@'); + expect(getFormatFromId(50, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'nb-NO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'nb-NO')).toBe('dd.mm.yyyy'); + }); + test('nl-NL', () => { + expect(getFormatFromId(1, 'nl-NL')).toBe('0'); + expect(getFormatFromId(2, 'nl-NL')).toBe('0.00'); + expect(getFormatFromId(3, 'nl-NL')).toBe('#,##0'); + expect(getFormatFromId(4, 'nl-NL')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'nl-NL')).toBe('€ #,##0;€ -#,##0'); + expect(getFormatFromId(6, 'nl-NL')).toBe('€ #,##0;[Red]€ -#,##0'); + expect(getFormatFromId(7, 'nl-NL')).toBe('€ #,##0.00;€ -#,##0.00'); + expect(getFormatFromId(8, 'nl-NL')).toBe('€ #,##0.00;[Red]€ -#,##0.00'); + expect(getFormatFromId(9, 'nl-NL')).toBe('0%'); + expect(getFormatFromId(10, 'nl-NL')).toBe('0.00%'); + expect(getFormatFromId(11, 'nl-NL')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'nl-NL')).toBe('# ?/?'); + expect(getFormatFromId(13, 'nl-NL')).toBe('# ??/??'); + expect(getFormatFromId(14, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(15, 'nl-NL')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'nl-NL')).toBe('d-mmm'); + expect(getFormatFromId(17, 'nl-NL')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'nl-NL')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'nl-NL')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'nl-NL')).toBe('hh:mm'); + expect(getFormatFromId(21, 'nl-NL')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'nl-NL')).toBe('d-m-yyyy hh:mm'); + expect(getFormatFromId(27, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(28, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(29, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(30, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(31, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(32, 'nl-NL')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'nl-NL')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'nl-NL')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'nl-NL')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(37, 'nl-NL')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'nl-NL')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'nl-NL')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'nl-NL')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'nl-NL')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'nl-NL')).toBe('_ € * #,##0_ ;_ € * -#,##0_ ;_ € * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'nl-NL')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'nl-NL')).toBe('_ € * #,##0.00_ ;_ € * -#,##0.00_ ;_ € * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'nl-NL')).toBe('mm:ss'); + expect(getFormatFromId(46, 'nl-NL')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'nl-NL')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'nl-NL')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'nl-NL')).toBe('@'); + expect(getFormatFromId(50, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(51, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(52, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(53, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(54, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(55, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(56, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(57, 'nl-NL')).toBe('d-m-yyyy'); + expect(getFormatFromId(58, 'nl-NL')).toBe('d-m-yyyy'); + }); + test('pa-IN', () => { + expect(getFormatFromId(1, 'pa-IN')).toBe('0'); + expect(getFormatFromId(2, 'pa-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'pa-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'pa-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'pa-IN')).toBe('₹ #,##0;₹ -#,##0'); + expect(getFormatFromId(6, 'pa-IN')).toBe('₹ #,##0;[Red]₹ -#,##0'); + expect(getFormatFromId(7, 'pa-IN')).toBe('₹ #,##0.00;₹ -#,##0.00'); + expect(getFormatFromId(8, 'pa-IN')).toBe('₹ #,##0.00;[Red]₹ -#,##0.00'); + expect(getFormatFromId(9, 'pa-IN')).toBe('0%'); + expect(getFormatFromId(10, 'pa-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'pa-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'pa-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'pa-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(15, 'pa-IN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'pa-IN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'pa-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'pa-IN')).toBe('hh:mm AM/PM'); + expect(getFormatFromId(19, 'pa-IN')).toBe('hh:mm:ss AM/PM'); + expect(getFormatFromId(20, 'pa-IN')).toBe('hh:mm'); + expect(getFormatFromId(21, 'pa-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'pa-IN')).toBe('dd-mm-yy hh:mm'); + expect(getFormatFromId(27, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(28, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(29, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(30, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(31, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(32, 'pa-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'pa-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'pa-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'pa-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(37, 'pa-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'pa-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'pa-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'pa-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'pa-IN')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'pa-IN')).toBe('_ ₹ * #,##0_ ;_ ₹ * -#,##0_ ;_ ₹ * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'pa-IN')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'pa-IN')).toBe('_ ₹ * #,##0.00_ ;_ ₹ * -#,##0.00_ ;_ ₹ * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'pa-IN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'pa-IN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'pa-IN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'pa-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'pa-IN')).toBe('@'); + expect(getFormatFromId(50, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(51, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(52, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(53, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(54, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(55, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(56, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(57, 'pa-IN')).toBe('dd-mm-yy'); + expect(getFormatFromId(58, 'pa-IN')).toBe('dd-mm-yy'); + }); + test('pl-PL', () => { + expect(getFormatFromId(1, 'pl-PL')).toBe('0'); + expect(getFormatFromId(2, 'pl-PL')).toBe('0.00'); + expect(getFormatFromId(3, 'pl-PL')).toBe('#,##0'); + expect(getFormatFromId(4, 'pl-PL')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'pl-PL')).toBe('#,##0 "zł";-#,##0 "zł"'); + expect(getFormatFromId(6, 'pl-PL')).toBe('#,##0 "zł";[Red]-#,##0 "zł"'); + expect(getFormatFromId(7, 'pl-PL')).toBe('#,##0.00 "zł";-#,##0.00 "zł"'); + expect(getFormatFromId(8, 'pl-PL')).toBe('#,##0.00 "zł";[Red]-#,##0.00 "zł"'); + expect(getFormatFromId(9, 'pl-PL')).toBe('0%'); + expect(getFormatFromId(10, 'pl-PL')).toBe('0.00%'); + expect(getFormatFromId(11, 'pl-PL')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'pl-PL')).toBe('# ?/?'); + expect(getFormatFromId(13, 'pl-PL')).toBe('# ??/??'); + expect(getFormatFromId(14, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(15, 'pl-PL')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'pl-PL')).toBe('d.mmm'); + expect(getFormatFromId(17, 'pl-PL')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'pl-PL')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'pl-PL')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'pl-PL')).toBe('hh:mm'); + expect(getFormatFromId(21, 'pl-PL')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'pl-PL')).toBe('d.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(28, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(29, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(30, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(31, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(32, 'pl-PL')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'pl-PL')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'pl-PL')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'pl-PL')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(37, 'pl-PL')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'pl-PL')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'pl-PL')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'pl-PL')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'pl-PL')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'pl-PL')).toBe('_-* #,##0 "zł"_-;-* #,##0 "zł"_-;_-* "-" "zł"_-;_-@_-'); + expect(getFormatFromId(43, 'pl-PL')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'pl-PL')).toBe('_-* #,##0.00 "zł"_-;-* #,##0.00 "zł"_-;_-* "-"?? "zł"_-;_-@_-'); + expect(getFormatFromId(45, 'pl-PL')).toBe('mm:ss'); + expect(getFormatFromId(46, 'pl-PL')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'pl-PL')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'pl-PL')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'pl-PL')).toBe('@'); + expect(getFormatFromId(50, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(51, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(52, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(53, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(54, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(55, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(56, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(57, 'pl-PL')).toBe('d.mm.yyyy'); + expect(getFormatFromId(58, 'pl-PL')).toBe('d.mm.yyyy'); + }); + test('pt-BR', () => { + expect(getFormatFromId(1, 'pt-BR')).toBe('0'); + expect(getFormatFromId(2, 'pt-BR')).toBe('0.00'); + expect(getFormatFromId(3, 'pt-BR')).toBe('#,##0'); + expect(getFormatFromId(4, 'pt-BR')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'pt-BR')).toBe('"R$" #,##0;-"R$" #,##0'); + expect(getFormatFromId(6, 'pt-BR')).toBe('"R$" #,##0;[Red]-"R$" #,##0'); + expect(getFormatFromId(7, 'pt-BR')).toBe('"R$" #,##0.00;-"R$" #,##0.00'); + expect(getFormatFromId(8, 'pt-BR')).toBe('"R$" #,##0.00;[Red]-"R$" #,##0.00'); + expect(getFormatFromId(9, 'pt-BR')).toBe('0%'); + expect(getFormatFromId(10, 'pt-BR')).toBe('0.00%'); + expect(getFormatFromId(11, 'pt-BR')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'pt-BR')).toBe('# ?/?'); + expect(getFormatFromId(13, 'pt-BR')).toBe('# ??/??'); + expect(getFormatFromId(14, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'pt-BR')).toBe('dd/mmm/yy'); + expect(getFormatFromId(16, 'pt-BR')).toBe('dd/mmm'); + expect(getFormatFromId(17, 'pt-BR')).toBe('mmm/yy'); + expect(getFormatFromId(18, 'pt-BR')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'pt-BR')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'pt-BR')).toBe('hh:mm'); + expect(getFormatFromId(21, 'pt-BR')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'pt-BR')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'pt-BR')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'pt-BR')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'pt-BR')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'pt-BR')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'pt-BR')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'pt-BR')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'pt-BR')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'pt-BR')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'pt-BR')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'pt-BR')).toBe('_-"R$" * #,##0_-;-"R$" * #,##0_-;_-"R$" * "-"_-;_-@_-'); + expect(getFormatFromId(43, 'pt-BR')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'pt-BR')).toBe('_-"R$" * #,##0.00_-;-"R$" * #,##0.00_-;_-"R$" * "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'pt-BR')).toBe('mm:ss'); + expect(getFormatFromId(46, 'pt-BR')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'pt-BR')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'pt-BR')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'pt-BR')).toBe('@'); + expect(getFormatFromId(50, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'pt-BR')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'pt-BR')).toBe('dd/mm/yyyy'); + }); + test('pt-PT', () => { + expect(getFormatFromId(1, 'pt-PT')).toBe('0'); + expect(getFormatFromId(2, 'pt-PT')).toBe('0.00'); + expect(getFormatFromId(3, 'pt-PT')).toBe('#,##0'); + expect(getFormatFromId(4, 'pt-PT')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'pt-PT')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'pt-PT')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'pt-PT')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'pt-PT')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'pt-PT')).toBe('0%'); + expect(getFormatFromId(10, 'pt-PT')).toBe('0.00%'); + expect(getFormatFromId(11, 'pt-PT')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'pt-PT')).toBe('# ?/?'); + expect(getFormatFromId(13, 'pt-PT')).toBe('# ??/??'); + expect(getFormatFromId(14, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'pt-PT')).toBe('dd/mmm/yy'); + expect(getFormatFromId(16, 'pt-PT')).toBe('dd/mmm'); + expect(getFormatFromId(17, 'pt-PT')).toBe('mmm/yy'); + expect(getFormatFromId(18, 'pt-PT')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'pt-PT')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'pt-PT')).toBe('hh:mm'); + expect(getFormatFromId(21, 'pt-PT')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'pt-PT')).toBe('dd/mm/yyyy hh:mm'); + expect(getFormatFromId(27, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'pt-PT')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'pt-PT')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'pt-PT')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'pt-PT')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'pt-PT')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'pt-PT')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'pt-PT')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'pt-PT')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'pt-PT')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'pt-PT')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'pt-PT')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'pt-PT')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'pt-PT')).toBe('mm:ss'); + expect(getFormatFromId(46, 'pt-PT')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'pt-PT')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'pt-PT')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'pt-PT')).toBe('@'); + expect(getFormatFromId(50, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'pt-PT')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'pt-PT')).toBe('dd/mm/yyyy'); + }); + test('ro-RO', () => { + expect(getFormatFromId(1, 'ro-RO')).toBe('0'); + expect(getFormatFromId(2, 'ro-RO')).toBe('0.00'); + expect(getFormatFromId(3, 'ro-RO')).toBe('#,##0'); + expect(getFormatFromId(4, 'ro-RO')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ro-RO')).toBe('#,##0 "lei";-#,##0 "lei"'); + expect(getFormatFromId(6, 'ro-RO')).toBe('#,##0 "lei";[Red]-#,##0 "lei"'); + expect(getFormatFromId(7, 'ro-RO')).toBe('#,##0.00 "lei";-#,##0.00 "lei"'); + expect(getFormatFromId(8, 'ro-RO')).toBe('#,##0.00 "lei";[Red]-#,##0.00 "lei"'); + expect(getFormatFromId(9, 'ro-RO')).toBe('0%'); + expect(getFormatFromId(10, 'ro-RO')).toBe('0.00%'); + expect(getFormatFromId(11, 'ro-RO')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ro-RO')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ro-RO')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'ro-RO')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'ro-RO')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'ro-RO')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'ro-RO')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'ro-RO')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ro-RO')).toBe('hh:mm'); + expect(getFormatFromId(21, 'ro-RO')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'ro-RO')).toBe('dd.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'ro-RO')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'ro-RO')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'ro-RO')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'ro-RO')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'ro-RO')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ro-RO')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ro-RO')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ro-RO')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ro-RO')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'ro-RO')).toBe('_-* #,##0 "lei"_-;-* #,##0 "lei"_-;_-* "-" "lei"_-;_-@_-'); + expect(getFormatFromId(43, 'ro-RO')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'ro-RO')).toBe('_-* #,##0.00 "lei"_-;-* #,##0.00 "lei"_-;_-* "-"?? "lei"_-;_-@_-'); + expect(getFormatFromId(45, 'ro-RO')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ro-RO')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ro-RO')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ro-RO')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ro-RO')).toBe('@'); + expect(getFormatFromId(50, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'ro-RO')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'ro-RO')).toBe('dd.mm.yyyy'); + }); + test('ru-RU', () => { + expect(getFormatFromId(1, 'ru-RU')).toBe('0'); + expect(getFormatFromId(2, 'ru-RU')).toBe('0.00'); + expect(getFormatFromId(3, 'ru-RU')).toBe('#,##0'); + expect(getFormatFromId(4, 'ru-RU')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ru-RU')).toBe('#,##0 ₽;-#,##0 ₽'); + expect(getFormatFromId(6, 'ru-RU')).toBe('#,##0 ₽;[Red]-#,##0 ₽'); + expect(getFormatFromId(7, 'ru-RU')).toBe('#,##0.00 ₽;-#,##0.00 ₽'); + expect(getFormatFromId(8, 'ru-RU')).toBe('#,##0.00 ₽;[Red]-#,##0.00 ₽'); + expect(getFormatFromId(9, 'ru-RU')).toBe('0%'); + expect(getFormatFromId(10, 'ru-RU')).toBe('0.00%'); + expect(getFormatFromId(11, 'ru-RU')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ru-RU')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ru-RU')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'ru-RU')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'ru-RU')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'ru-RU')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'ru-RU')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'ru-RU')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ru-RU')).toBe('h:mm'); + expect(getFormatFromId(21, 'ru-RU')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'ru-RU')).toBe('dd.mm.yyyy h:mm'); + expect(getFormatFromId(27, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'ru-RU')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'ru-RU')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'ru-RU')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'ru-RU')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'ru-RU')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ru-RU')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ru-RU')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ru-RU')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ru-RU')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'ru-RU')).toBe('_-* #,##0 ₽_-;-* #,##0 ₽_-;_-* "-" ₽_-;_-@_-'); + expect(getFormatFromId(43, 'ru-RU')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'ru-RU')).toBe('_-* #,##0.00 ₽_-;-* #,##0.00 ₽_-;_-* "-"?? ₽_-;_-@_-'); + expect(getFormatFromId(45, 'ru-RU')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ru-RU')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ru-RU')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ru-RU')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ru-RU')).toBe('@'); + expect(getFormatFromId(50, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'ru-RU')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'ru-RU')).toBe('dd.mm.yyyy'); + }); + test('sk-SK', () => { + expect(getFormatFromId(1, 'sk-SK')).toBe('0'); + expect(getFormatFromId(2, 'sk-SK')).toBe('0.00'); + expect(getFormatFromId(3, 'sk-SK')).toBe('#,##0'); + expect(getFormatFromId(4, 'sk-SK')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'sk-SK')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'sk-SK')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'sk-SK')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'sk-SK')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'sk-SK')).toBe('0%'); + expect(getFormatFromId(10, 'sk-SK')).toBe('0.00%'); + expect(getFormatFromId(11, 'sk-SK')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'sk-SK')).toBe('# ?/?'); + expect(getFormatFromId(13, 'sk-SK')).toBe('# ??/??'); + expect(getFormatFromId(14, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(15, 'sk-SK')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'sk-SK')).toBe('d.mmm'); + expect(getFormatFromId(17, 'sk-SK')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'sk-SK')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'sk-SK')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'sk-SK')).toBe('h:mm'); + expect(getFormatFromId(21, 'sk-SK')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'sk-SK')).toBe('d.m.yyyy h:mm'); + expect(getFormatFromId(27, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(28, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(29, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(30, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(31, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(32, 'sk-SK')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'sk-SK')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'sk-SK')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'sk-SK')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(37, 'sk-SK')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'sk-SK')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'sk-SK')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'sk-SK')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'sk-SK')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'sk-SK')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'sk-SK')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'sk-SK')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'sk-SK')).toBe('mm:ss'); + expect(getFormatFromId(46, 'sk-SK')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'sk-SK')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'sk-SK')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'sk-SK')).toBe('@'); + expect(getFormatFromId(50, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(51, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(52, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(53, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(54, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(55, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(56, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(57, 'sk-SK')).toBe('d.m.yyyy'); + expect(getFormatFromId(58, 'sk-SK')).toBe('d.m.yyyy'); + }); + test('sl-SI', () => { + expect(getFormatFromId(1, 'sl-SI')).toBe('0'); + expect(getFormatFromId(2, 'sl-SI')).toBe('0.00'); + expect(getFormatFromId(3, 'sl-SI')).toBe('#,##0'); + expect(getFormatFromId(4, 'sl-SI')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'sl-SI')).toBe('#,##0 €;-#,##0 €'); + expect(getFormatFromId(6, 'sl-SI')).toBe('#,##0 €;[Red]-#,##0 €'); + expect(getFormatFromId(7, 'sl-SI')).toBe('#,##0.00 €;-#,##0.00 €'); + expect(getFormatFromId(8, 'sl-SI')).toBe('#,##0.00 €;[Red]-#,##0.00 €'); + expect(getFormatFromId(9, 'sl-SI')).toBe('0%'); + expect(getFormatFromId(10, 'sl-SI')).toBe('0.00%'); + expect(getFormatFromId(11, 'sl-SI')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'sl-SI')).toBe('# ?/?'); + expect(getFormatFromId(13, 'sl-SI')).toBe('# ??/??'); + expect(getFormatFromId(14, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(15, 'sl-SI')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'sl-SI')).toBe('d.mmm'); + expect(getFormatFromId(17, 'sl-SI')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'sl-SI')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'sl-SI')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'sl-SI')).toBe('hh:mm'); + expect(getFormatFromId(21, 'sl-SI')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'sl-SI')).toBe('d.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(28, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(29, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(30, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(31, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(32, 'sl-SI')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'sl-SI')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'sl-SI')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'sl-SI')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(37, 'sl-SI')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'sl-SI')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'sl-SI')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'sl-SI')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'sl-SI')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'sl-SI')).toBe('_-* #,##0 €_-;-* #,##0 €_-;_-* "-" €_-;_-@_-'); + expect(getFormatFromId(43, 'sl-SI')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'sl-SI')).toBe('_-* #,##0.00 €_-;-* #,##0.00 €_-;_-* "-"?? €_-;_-@_-'); + expect(getFormatFromId(45, 'sl-SI')).toBe('mm:ss'); + expect(getFormatFromId(46, 'sl-SI')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'sl-SI')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'sl-SI')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'sl-SI')).toBe('@'); + expect(getFormatFromId(50, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(51, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(52, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(53, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(54, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(55, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(56, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(57, 'sl-SI')).toBe('d.mm.yyyy'); + expect(getFormatFromId(58, 'sl-SI')).toBe('d.mm.yyyy'); + }); + test('sr-RS', () => { + expect(getFormatFromId(1, 'sr-RS')).toBe('0'); + expect(getFormatFromId(2, 'sr-RS')).toBe('0.00'); + expect(getFormatFromId(3, 'sr-RS')).toBe('#,##0'); + expect(getFormatFromId(4, 'sr-RS')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'sr-RS')).toBe('#,##0 "RSD";-#,##0 "RSD"'); + expect(getFormatFromId(6, 'sr-RS')).toBe('#,##0 "RSD";[Red]-#,##0 "RSD"'); + expect(getFormatFromId(7, 'sr-RS')).toBe('#,##0.00 "RSD";-#,##0.00 "RSD"'); + expect(getFormatFromId(8, 'sr-RS')).toBe('#,##0.00 "RSD";[Red]-#,##0.00 "RSD"'); + expect(getFormatFromId(9, 'sr-RS')).toBe('0%'); + expect(getFormatFromId(10, 'sr-RS')).toBe('0.00%'); + expect(getFormatFromId(11, 'sr-RS')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'sr-RS')).toBe('# ?/?'); + expect(getFormatFromId(13, 'sr-RS')).toBe('# ??/??'); + expect(getFormatFromId(14, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(15, 'sr-RS')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'sr-RS')).toBe('d.mmm'); + expect(getFormatFromId(17, 'sr-RS')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'sr-RS')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'sr-RS')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'sr-RS')).toBe('hh:mm'); + expect(getFormatFromId(21, 'sr-RS')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'sr-RS')).toBe('d.m.yyyy hh:mm'); + expect(getFormatFromId(27, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(28, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(29, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(30, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(31, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(32, 'sr-RS')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'sr-RS')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'sr-RS')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'sr-RS')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(37, 'sr-RS')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'sr-RS')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'sr-RS')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'sr-RS')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'sr-RS')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'sr-RS')).toBe('_-* #,##0 "RSD"_-;-* #,##0 "RSD"_-;_-* "-" "RSD"_-;_-@_-'); + expect(getFormatFromId(43, 'sr-RS')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'sr-RS')).toBe('_-* #,##0.00 "RSD"_-;-* #,##0.00 "RSD"_-;_-* "-"?? "RSD"_-;_-@_-'); + expect(getFormatFromId(45, 'sr-RS')).toBe('mm:ss'); + expect(getFormatFromId(46, 'sr-RS')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'sr-RS')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'sr-RS')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'sr-RS')).toBe('@'); + expect(getFormatFromId(50, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(51, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(52, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(53, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(54, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(55, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(56, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(57, 'sr-RS')).toBe('d.m.yyyy'); + expect(getFormatFromId(58, 'sr-RS')).toBe('d.m.yyyy'); + }); + test('sv-SE', () => { + expect(getFormatFromId(1, 'sv-SE')).toBe('0'); + expect(getFormatFromId(2, 'sv-SE')).toBe('0.00'); + expect(getFormatFromId(3, 'sv-SE')).toBe('#,##0'); + expect(getFormatFromId(4, 'sv-SE')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'sv-SE')).toBe('#,##0 "kr";-#,##0 "kr"'); + expect(getFormatFromId(6, 'sv-SE')).toBe('#,##0 "kr";[Red]-#,##0 "kr"'); + expect(getFormatFromId(7, 'sv-SE')).toBe('#,##0.00 "kr";-#,##0.00 "kr"'); + expect(getFormatFromId(8, 'sv-SE')).toBe('#,##0.00 "kr";[Red]-#,##0.00 "kr"'); + expect(getFormatFromId(9, 'sv-SE')).toBe('0%'); + expect(getFormatFromId(10, 'sv-SE')).toBe('0.00%'); + expect(getFormatFromId(11, 'sv-SE')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'sv-SE')).toBe('# ?/?'); + expect(getFormatFromId(13, 'sv-SE')).toBe('# ??/??'); + expect(getFormatFromId(14, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(15, 'sv-SE')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'sv-SE')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'sv-SE')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'sv-SE')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'sv-SE')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'sv-SE')).toBe('hh:mm'); + expect(getFormatFromId(21, 'sv-SE')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'sv-SE')).toBe('yyyy-mm-dd hh:mm'); + expect(getFormatFromId(27, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(28, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(29, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(30, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(31, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(32, 'sv-SE')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'sv-SE')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'sv-SE')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'sv-SE')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(37, 'sv-SE')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'sv-SE')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'sv-SE')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'sv-SE')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'sv-SE')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'sv-SE')).toBe('_-* #,##0 "kr"_-;-* #,##0 "kr"_-;_-* "-" "kr"_-;_-@_-'); + expect(getFormatFromId(43, 'sv-SE')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'sv-SE')).toBe('_-* #,##0.00 "kr"_-;-* #,##0.00 "kr"_-;_-* "-"?? "kr"_-;_-@_-'); + expect(getFormatFromId(45, 'sv-SE')).toBe('mm:ss'); + expect(getFormatFromId(46, 'sv-SE')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'sv-SE')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'sv-SE')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'sv-SE')).toBe('@'); + expect(getFormatFromId(50, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(51, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(52, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(53, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(54, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(55, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(56, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(57, 'sv-SE')).toBe('yyyy-mm-dd'); + expect(getFormatFromId(58, 'sv-SE')).toBe('yyyy-mm-dd'); + }); + test('ta-IN', () => { + expect(getFormatFromId(1, 'ta-IN')).toBe('0'); + expect(getFormatFromId(2, 'ta-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'ta-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'ta-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'ta-IN')).toBe('₹ #,##0;₹ -#,##0'); + expect(getFormatFromId(6, 'ta-IN')).toBe('₹ #,##0;[Red]₹ -#,##0'); + expect(getFormatFromId(7, 'ta-IN')).toBe('₹ #,##0.00;₹ -#,##0.00'); + expect(getFormatFromId(8, 'ta-IN')).toBe('₹ #,##0.00;[Red]₹ -#,##0.00'); + expect(getFormatFromId(9, 'ta-IN')).toBe('0%'); + expect(getFormatFromId(10, 'ta-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'ta-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'ta-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'ta-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(15, 'ta-IN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'ta-IN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'ta-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'ta-IN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'ta-IN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'ta-IN')).toBe('hh:mm'); + expect(getFormatFromId(21, 'ta-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'ta-IN')).toBe('dd-mm-yyyy hh:mm'); + expect(getFormatFromId(27, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(28, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(29, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(30, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(31, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(32, 'ta-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'ta-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'ta-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'ta-IN')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(37, 'ta-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'ta-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'ta-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'ta-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'ta-IN')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'ta-IN')).toBe('_ ₹ * #,##0_ ;_ ₹ * -#,##0_ ;_ ₹ * "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'ta-IN')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'ta-IN')).toBe('_ ₹ * #,##0.00_ ;_ ₹ * -#,##0.00_ ;_ ₹ * "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'ta-IN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'ta-IN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'ta-IN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'ta-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'ta-IN')).toBe('@'); + expect(getFormatFromId(50, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(51, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(52, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(53, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(54, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(55, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(56, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(57, 'ta-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(58, 'ta-IN')).toBe('dd-mm-yyyy'); + }); + test('te-IN', () => { + expect(getFormatFromId(1, 'te-IN')).toBe('0'); + expect(getFormatFromId(2, 'te-IN')).toBe('0.00'); + expect(getFormatFromId(3, 'te-IN')).toBe('#,##0'); + expect(getFormatFromId(4, 'te-IN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'te-IN')).toBe('₹#,##0;-₹#,##0'); + expect(getFormatFromId(6, 'te-IN')).toBe('₹#,##0;[Red]-₹#,##0'); + expect(getFormatFromId(7, 'te-IN')).toBe('₹#,##0.00;-₹#,##0.00'); + expect(getFormatFromId(8, 'te-IN')).toBe('₹#,##0.00;[Red]-₹#,##0.00'); + expect(getFormatFromId(9, 'te-IN')).toBe('0%'); + expect(getFormatFromId(10, 'te-IN')).toBe('0.00%'); + expect(getFormatFromId(11, 'te-IN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'te-IN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'te-IN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(15, 'te-IN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'te-IN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'te-IN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'te-IN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'te-IN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'te-IN')).toBe('h:mm'); + expect(getFormatFromId(21, 'te-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'te-IN')).toBe('dd-mm-yyyy h:mm'); + expect(getFormatFromId(27, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(28, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(29, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(30, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(31, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(32, 'te-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'te-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'te-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'te-IN')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(37, 'te-IN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'te-IN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'te-IN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'te-IN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'te-IN')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'te-IN')).toBe('_-₹* #,##0_-;-₹* #,##0_-;_-₹* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'te-IN')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'te-IN')).toBe('_-₹* #,##0.00_-;-₹* #,##0.00_-;_-₹* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'te-IN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'te-IN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'te-IN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'te-IN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'te-IN')).toBe('@'); + expect(getFormatFromId(50, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(51, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(52, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(53, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(54, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(55, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(56, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(57, 'te-IN')).toBe('dd-mm-yyyy'); + expect(getFormatFromId(58, 'te-IN')).toBe('dd-mm-yyyy'); + }); + test('th-TH', () => { + expect(getFormatFromId(1, 'th-TH')).toBe('0'); + expect(getFormatFromId(2, 'th-TH')).toBe('0.00'); + expect(getFormatFromId(3, 'th-TH')).toBe('#,##0'); + expect(getFormatFromId(4, 'th-TH')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'th-TH')).toBe('฿#,##0;-฿#,##0'); + expect(getFormatFromId(6, 'th-TH')).toBe('฿#,##0;[Red]-฿#,##0'); + expect(getFormatFromId(7, 'th-TH')).toBe('฿#,##0.00;-฿#,##0.00'); + expect(getFormatFromId(8, 'th-TH')).toBe('฿#,##0.00;[Red]-฿#,##0.00'); + expect(getFormatFromId(9, 'th-TH')).toBe('0%'); + expect(getFormatFromId(10, 'th-TH')).toBe('0.00%'); + expect(getFormatFromId(11, 'th-TH')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'th-TH')).toBe('# ?/?'); + expect(getFormatFromId(13, 'th-TH')).toBe('# ??/??'); + expect(getFormatFromId(14, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'th-TH')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'th-TH')).toBe('d-mmm'); + expect(getFormatFromId(17, 'th-TH')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'th-TH')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'th-TH')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'th-TH')).toBe('h:mm'); + expect(getFormatFromId(21, 'th-TH')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'th-TH')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'th-TH')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'th-TH')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'th-TH')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'th-TH')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'th-TH')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'th-TH')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'th-TH')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'th-TH')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'th-TH')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'th-TH')).toBe('_-฿* #,##0_-;-฿* #,##0_-;_-฿* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'th-TH')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'th-TH')).toBe('_-฿* #,##0.00_-;-฿* #,##0.00_-;_-฿* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'th-TH')).toBe('mm:ss'); + expect(getFormatFromId(46, 'th-TH')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'th-TH')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'th-TH')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'th-TH')).toBe('@'); + expect(getFormatFromId(50, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'th-TH')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'th-TH')).toBe('d/m/yyyy'); + }); + test('tr-TR', () => { + expect(getFormatFromId(1, 'tr-TR')).toBe('0'); + expect(getFormatFromId(2, 'tr-TR')).toBe('0.00'); + expect(getFormatFromId(3, 'tr-TR')).toBe('#,##0'); + expect(getFormatFromId(4, 'tr-TR')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'tr-TR')).toBe('₺#,##0;-₺#,##0'); + expect(getFormatFromId(6, 'tr-TR')).toBe('₺#,##0;[Red]-₺#,##0'); + expect(getFormatFromId(7, 'tr-TR')).toBe('₺#,##0.00;-₺#,##0.00'); + expect(getFormatFromId(8, 'tr-TR')).toBe('₺#,##0.00;[Red]-₺#,##0.00'); + expect(getFormatFromId(9, 'tr-TR')).toBe('0%'); + expect(getFormatFromId(10, 'tr-TR')).toBe('0.00%'); + expect(getFormatFromId(11, 'tr-TR')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'tr-TR')).toBe('# ?/?'); + expect(getFormatFromId(13, 'tr-TR')).toBe('# ??/??'); + expect(getFormatFromId(14, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(15, 'tr-TR')).toBe('d.mmm.yy'); + expect(getFormatFromId(16, 'tr-TR')).toBe('d.mmm'); + expect(getFormatFromId(17, 'tr-TR')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'tr-TR')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'tr-TR')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'tr-TR')).toBe('hh:mm'); + expect(getFormatFromId(21, 'tr-TR')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'tr-TR')).toBe('d.mm.yyyy hh:mm'); + expect(getFormatFromId(27, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(28, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(29, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(30, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(31, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(32, 'tr-TR')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'tr-TR')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'tr-TR')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'tr-TR')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(37, 'tr-TR')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'tr-TR')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'tr-TR')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'tr-TR')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'tr-TR')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'tr-TR')).toBe('_-₺* #,##0_-;-₺* #,##0_-;_-₺* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'tr-TR')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'tr-TR')).toBe('_-₺* #,##0.00_-;-₺* #,##0.00_-;_-₺* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'tr-TR')).toBe('mm:ss'); + expect(getFormatFromId(46, 'tr-TR')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'tr-TR')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'tr-TR')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'tr-TR')).toBe('@'); + expect(getFormatFromId(50, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(51, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(52, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(53, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(54, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(55, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(56, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(57, 'tr-TR')).toBe('d.mm.yyyy'); + expect(getFormatFromId(58, 'tr-TR')).toBe('d.mm.yyyy'); + }); + test('uk-UA', () => { + expect(getFormatFromId(1, 'uk-UA')).toBe('0'); + expect(getFormatFromId(2, 'uk-UA')).toBe('0.00'); + expect(getFormatFromId(3, 'uk-UA')).toBe('#,##0'); + expect(getFormatFromId(4, 'uk-UA')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'uk-UA')).toBe('#,##0 ₴;-#,##0 ₴'); + expect(getFormatFromId(6, 'uk-UA')).toBe('#,##0 ₴;[Red]-#,##0 ₴'); + expect(getFormatFromId(7, 'uk-UA')).toBe('#,##0.00 ₴;-#,##0.00 ₴'); + expect(getFormatFromId(8, 'uk-UA')).toBe('#,##0.00 ₴;[Red]-#,##0.00 ₴'); + expect(getFormatFromId(9, 'uk-UA')).toBe('0%'); + expect(getFormatFromId(10, 'uk-UA')).toBe('0.00%'); + expect(getFormatFromId(11, 'uk-UA')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'uk-UA')).toBe('# ?/?'); + expect(getFormatFromId(13, 'uk-UA')).toBe('# ??/??'); + expect(getFormatFromId(14, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(15, 'uk-UA')).toBe('dd.mmm.yy'); + expect(getFormatFromId(16, 'uk-UA')).toBe('dd.mmm'); + expect(getFormatFromId(17, 'uk-UA')).toBe('mmm.yy'); + expect(getFormatFromId(18, 'uk-UA')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'uk-UA')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'uk-UA')).toBe('h:mm'); + expect(getFormatFromId(21, 'uk-UA')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'uk-UA')).toBe('dd.mm.yyyy h:mm'); + expect(getFormatFromId(27, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(28, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(29, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(30, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(31, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(32, 'uk-UA')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'uk-UA')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'uk-UA')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'uk-UA')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(37, 'uk-UA')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'uk-UA')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'uk-UA')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'uk-UA')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'uk-UA')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'uk-UA')).toBe('_-* #,##0 ₴_-;-* #,##0 ₴_-;_-* "-" ₴_-;_-@_-'); + expect(getFormatFromId(43, 'uk-UA')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'uk-UA')).toBe('_-* #,##0.00 ₴_-;-* #,##0.00 ₴_-;_-* "-"?? ₴_-;_-@_-'); + expect(getFormatFromId(45, 'uk-UA')).toBe('mm:ss'); + expect(getFormatFromId(46, 'uk-UA')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'uk-UA')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'uk-UA')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'uk-UA')).toBe('@'); + expect(getFormatFromId(50, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(51, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(52, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(53, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(54, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(55, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(56, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(57, 'uk-UA')).toBe('dd.mm.yyyy'); + expect(getFormatFromId(58, 'uk-UA')).toBe('dd.mm.yyyy'); + }); + test('vi-VN', () => { + expect(getFormatFromId(1, 'vi-VN')).toBe('0'); + expect(getFormatFromId(2, 'vi-VN')).toBe('0.00'); + expect(getFormatFromId(3, 'vi-VN')).toBe('#,##0'); + expect(getFormatFromId(4, 'vi-VN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'vi-VN')).toBe('#,##0 ₫;-#,##0 ₫'); + expect(getFormatFromId(6, 'vi-VN')).toBe('#,##0 ₫;[Red]-#,##0 ₫'); + expect(getFormatFromId(7, 'vi-VN')).toBe('#,##0.00 ₫;-#,##0.00 ₫'); + expect(getFormatFromId(8, 'vi-VN')).toBe('#,##0.00 ₫;[Red]-#,##0.00 ₫'); + expect(getFormatFromId(9, 'vi-VN')).toBe('0%'); + expect(getFormatFromId(10, 'vi-VN')).toBe('0.00%'); + expect(getFormatFromId(11, 'vi-VN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'vi-VN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'vi-VN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(15, 'vi-VN')).toBe('dd-mmm-yy'); + expect(getFormatFromId(16, 'vi-VN')).toBe('dd-mmm'); + expect(getFormatFromId(17, 'vi-VN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'vi-VN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'vi-VN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'vi-VN')).toBe('h:mm'); + expect(getFormatFromId(21, 'vi-VN')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'vi-VN')).toBe('dd/mm/yyyy h:mm'); + expect(getFormatFromId(27, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(28, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(29, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(30, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(31, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(32, 'vi-VN')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'vi-VN')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'vi-VN')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'vi-VN')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(37, 'vi-VN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'vi-VN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'vi-VN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'vi-VN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'vi-VN')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'vi-VN')).toBe('_-* #,##0 ₫_-;-* #,##0 ₫_-;_-* "-" ₫_-;_-@_-'); + expect(getFormatFromId(43, 'vi-VN')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'vi-VN')).toBe('_-* #,##0.00 ₫_-;-* #,##0.00 ₫_-;_-* "-"?? ₫_-;_-@_-'); + expect(getFormatFromId(45, 'vi-VN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'vi-VN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'vi-VN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'vi-VN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'vi-VN')).toBe('@'); + expect(getFormatFromId(50, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(51, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(52, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(53, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(54, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(55, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(56, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(57, 'vi-VN')).toBe('dd/mm/yyyy'); + expect(getFormatFromId(58, 'vi-VN')).toBe('dd/mm/yyyy'); + }); + test('zh-CN', () => { + expect(getFormatFromId(1, 'zh-CN')).toBe('0'); + expect(getFormatFromId(2, 'zh-CN')).toBe('0.00'); + expect(getFormatFromId(3, 'zh-CN')).toBe('#,##0'); + expect(getFormatFromId(4, 'zh-CN')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'zh-CN')).toBe('¥#,##0;¥-#,##0'); + expect(getFormatFromId(6, 'zh-CN')).toBe('¥#,##0;[Red]¥-#,##0'); + expect(getFormatFromId(7, 'zh-CN')).toBe('¥#,##0.00;¥-#,##0.00'); + expect(getFormatFromId(8, 'zh-CN')).toBe('¥#,##0.00;[Red]¥-#,##0.00'); + expect(getFormatFromId(9, 'zh-CN')).toBe('0%'); + expect(getFormatFromId(10, 'zh-CN')).toBe('0.00%'); + expect(getFormatFromId(11, 'zh-CN')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'zh-CN')).toBe('# ?/?'); + expect(getFormatFromId(13, 'zh-CN')).toBe('# ??/??'); + expect(getFormatFromId(14, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(15, 'zh-CN')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'zh-CN')).toBe('d-mmm'); + expect(getFormatFromId(17, 'zh-CN')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'zh-CN')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'zh-CN')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'zh-CN')).toBe('h:mm'); + expect(getFormatFromId(21, 'zh-CN')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'zh-CN')).toBe('yyyy/m/d h:mm'); + expect(getFormatFromId(27, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(28, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(29, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(30, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(31, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(32, 'zh-CN')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'zh-CN')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'zh-CN')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'zh-CN')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(37, 'zh-CN')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'zh-CN')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'zh-CN')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'zh-CN')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'zh-CN')).toBe('_ * #,##0_ ;_ * -#,##0_ ;_ * "-"_ ;_ @_ '); + expect(getFormatFromId(42, 'zh-CN')).toBe('_ ¥* #,##0_ ;_ ¥* -#,##0_ ;_ ¥* "-"_ ;_ @_ '); + expect(getFormatFromId(43, 'zh-CN')).toBe('_ * #,##0.00_ ;_ * -#,##0.00_ ;_ * "-"??_ ;_ @_ '); + expect(getFormatFromId(44, 'zh-CN')).toBe('_ ¥* #,##0.00_ ;_ ¥* -#,##0.00_ ;_ ¥* "-"??_ ;_ @_ '); + expect(getFormatFromId(45, 'zh-CN')).toBe('mm:ss'); + expect(getFormatFromId(46, 'zh-CN')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'zh-CN')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'zh-CN')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'zh-CN')).toBe('@'); + expect(getFormatFromId(50, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(51, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(52, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(53, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(54, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(55, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(56, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(57, 'zh-CN')).toBe('yyyy/m/d'); + expect(getFormatFromId(58, 'zh-CN')).toBe('yyyy/m/d'); + }); + test('zh-HK', () => { + expect(getFormatFromId(1, 'zh-HK')).toBe('0'); + expect(getFormatFromId(2, 'zh-HK')).toBe('0.00'); + expect(getFormatFromId(3, 'zh-HK')).toBe('#,##0'); + expect(getFormatFromId(4, 'zh-HK')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'zh-HK')).toBe('"HK$"#,##0_);("HK$"#,##0)'); + expect(getFormatFromId(6, 'zh-HK')).toBe('"HK$"#,##0_);[Red]("HK$"#,##0)'); + expect(getFormatFromId(7, 'zh-HK')).toBe('"HK$"#,##0.00_);("HK$"#,##0.00)'); + expect(getFormatFromId(8, 'zh-HK')).toBe('"HK$"#,##0.00_);[Red]("HK$"#,##0.00)'); + expect(getFormatFromId(9, 'zh-HK')).toBe('0%'); + expect(getFormatFromId(10, 'zh-HK')).toBe('0.00%'); + expect(getFormatFromId(11, 'zh-HK')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'zh-HK')).toBe('# ?/?'); + expect(getFormatFromId(13, 'zh-HK')).toBe('# ??/??'); + expect(getFormatFromId(14, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(15, 'zh-HK')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'zh-HK')).toBe('d-mmm'); + expect(getFormatFromId(17, 'zh-HK')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'zh-HK')).toBe('h:mm AM/PM'); + expect(getFormatFromId(19, 'zh-HK')).toBe('h:mm:ss AM/PM'); + expect(getFormatFromId(20, 'zh-HK')).toBe('h:mm'); + expect(getFormatFromId(21, 'zh-HK')).toBe('h:mm:ss'); + expect(getFormatFromId(22, 'zh-HK')).toBe('d/m/yyyy h:mm'); + expect(getFormatFromId(27, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(28, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(29, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(30, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(31, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(32, 'zh-HK')).toBe('h:mm:ss'); + expect(getFormatFromId(33, 'zh-HK')).toBe('h:mm:ss'); + expect(getFormatFromId(34, 'zh-HK')).toBe('h:mm:ss'); + expect(getFormatFromId(35, 'zh-HK')).toBe('h:mm:ss'); + expect(getFormatFromId(36, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(37, 'zh-HK')).toBe('#,##0_);(#,##0)'); + expect(getFormatFromId(38, 'zh-HK')).toBe('#,##0_);[Red](#,##0)'); + expect(getFormatFromId(39, 'zh-HK')).toBe('#,##0.00_);(#,##0.00)'); + expect(getFormatFromId(40, 'zh-HK')).toBe('#,##0.00_);[Red](#,##0.00)'); + expect(getFormatFromId(41, 'zh-HK')).toBe('_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)'); + expect(getFormatFromId(42, 'zh-HK')).toBe('_("HK$"* #,##0_);_("HK$"* (#,##0);_("HK$"* "-"_);_(@_)'); + expect(getFormatFromId(43, 'zh-HK')).toBe('_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)'); + expect(getFormatFromId(44, 'zh-HK')).toBe('_("HK$"* #,##0.00_);_("HK$"* (#,##0.00);_("HK$"* "-"??_);_(@_)'); + expect(getFormatFromId(45, 'zh-HK')).toBe('mm:ss'); + expect(getFormatFromId(46, 'zh-HK')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'zh-HK')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'zh-HK')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'zh-HK')).toBe('@'); + expect(getFormatFromId(50, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(51, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(52, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(53, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(54, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(55, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(56, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(57, 'zh-HK')).toBe('d/m/yyyy'); + expect(getFormatFromId(58, 'zh-HK')).toBe('d/m/yyyy'); + }); + test('zh-TW', () => { + expect(getFormatFromId(1, 'zh-TW')).toBe('0'); + expect(getFormatFromId(2, 'zh-TW')).toBe('0.00'); + expect(getFormatFromId(3, 'zh-TW')).toBe('#,##0'); + expect(getFormatFromId(4, 'zh-TW')).toBe('#,##0.00'); + expect(getFormatFromId(5, 'zh-TW')).toBe('"NT$"#,##0;-"NT$"#,##0'); + expect(getFormatFromId(6, 'zh-TW')).toBe('"NT$"#,##0;[Red]-"NT$"#,##0'); + expect(getFormatFromId(7, 'zh-TW')).toBe('"NT$"#,##0.00;-"NT$"#,##0.00'); + expect(getFormatFromId(8, 'zh-TW')).toBe('"NT$"#,##0.00;[Red]-"NT$"#,##0.00'); + expect(getFormatFromId(9, 'zh-TW')).toBe('0%'); + expect(getFormatFromId(10, 'zh-TW')).toBe('0.00%'); + expect(getFormatFromId(11, 'zh-TW')).toBe('0.00E+00'); + expect(getFormatFromId(12, 'zh-TW')).toBe('# ?/?'); + expect(getFormatFromId(13, 'zh-TW')).toBe('# ??/??'); + expect(getFormatFromId(14, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(15, 'zh-TW')).toBe('d-mmm-yy'); + expect(getFormatFromId(16, 'zh-TW')).toBe('d-mmm'); + expect(getFormatFromId(17, 'zh-TW')).toBe('mmm-yy'); + expect(getFormatFromId(18, 'zh-TW')).toBe('hh:mm AM/PM'); + expect(getFormatFromId(19, 'zh-TW')).toBe('hh:mm:ss AM/PM'); + expect(getFormatFromId(20, 'zh-TW')).toBe('hh:mm'); + expect(getFormatFromId(21, 'zh-TW')).toBe('hh:mm:ss'); + expect(getFormatFromId(22, 'zh-TW')).toBe('yyyy/m/d hh:mm'); + expect(getFormatFromId(27, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(28, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(29, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(30, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(31, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(32, 'zh-TW')).toBe('hh:mm:ss'); + expect(getFormatFromId(33, 'zh-TW')).toBe('hh:mm:ss'); + expect(getFormatFromId(34, 'zh-TW')).toBe('hh:mm:ss'); + expect(getFormatFromId(35, 'zh-TW')).toBe('hh:mm:ss'); + expect(getFormatFromId(36, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(37, 'zh-TW')).toBe('#,##0;-#,##0'); + expect(getFormatFromId(38, 'zh-TW')).toBe('#,##0;[Red]-#,##0'); + expect(getFormatFromId(39, 'zh-TW')).toBe('#,##0.00;-#,##0.00'); + expect(getFormatFromId(40, 'zh-TW')).toBe('#,##0.00;[Red]-#,##0.00'); + expect(getFormatFromId(41, 'zh-TW')).toBe('_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'); + expect(getFormatFromId(42, 'zh-TW')).toBe('_-"NT$"* #,##0_-;-"NT$"* #,##0_-;_-"NT$"* "-"_-;_-@_-'); + expect(getFormatFromId(43, 'zh-TW')).toBe('_-* #,##0.00_-;-* #,##0.00_-;_-* "-"??_-;_-@_-'); + expect(getFormatFromId(44, 'zh-TW')).toBe('_-"NT$"* #,##0.00_-;-"NT$"* #,##0.00_-;_-"NT$"* "-"??_-;_-@_-'); + expect(getFormatFromId(45, 'zh-TW')).toBe('mm:ss'); + expect(getFormatFromId(46, 'zh-TW')).toBe('[h]:mm:ss'); + expect(getFormatFromId(47, 'zh-TW')).toBe('mm:ss.0'); + expect(getFormatFromId(48, 'zh-TW')).toBe('##0.0E+0'); + expect(getFormatFromId(49, 'zh-TW')).toBe('@'); + expect(getFormatFromId(50, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(51, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(52, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(53, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(54, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(55, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(56, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(57, 'zh-TW')).toBe('yyyy/m/d'); + expect(getFormatFromId(58, 'zh-TW')).toBe('yyyy/m/d'); + }); +}); diff --git a/test/locale.spec.ts b/test/locale.spec.ts index 3da8701..deef1a9 100644 --- a/test/locale.spec.ts +++ b/test/locale.spec.ts @@ -1,5 +1,5 @@ -import { expect, test } from 'vitest'; -import { addLocale, format } from '../lib/index.ts'; +import { describe, expect, test } from 'vitest'; +import { addLocale, format, getLocale, listLocales } from '../lib/index.ts'; const date = 3290.1278435; // 1909-01-02 03:04:05.678 @@ -111,3 +111,12 @@ test('locale options', () => { expect(format('General', true, { locale: 'nl' })).toBe('WAAR'); expect(format('General', false, { locale: 'nl' })).toBe('ONWAAR'); }); + +describe('all locales have format settings', () => { + const locales = listLocales(); + for (const code of locales) { + test(code + ' has format settings', () => { + expect(getLocale(code)?.format).toBeTruthy(); + }); + } +}); diff --git a/test/parseValue-excel.spec.ts b/test/parseValue-excel.spec.ts index 197786b..f4d12f9 100644 --- a/test/parseValue-excel.spec.ts +++ b/test/parseValue-excel.spec.ts @@ -56,7 +56,7 @@ describe('parseValue: EXCEL mode', () => { for (const l of loc) { const opt = { locale: l }; // locales with preferMDY should allow dates that fit, else only allow DMY - const MDY = getLocale(l)?.preferMDY; + const MDY = !getLocale(l)?.format?.dateOrder; if (MDY) { expect(parseDate('07/05/82', opt), `${l} prefers MDY (07/05/82)`).toEqual({ v: 30137, z: 'm/d/yy' }); expect(parseDate('31/05/82', opt), `${l} prefers MDY (31/05/82)`).toEqual(undefined); diff --git a/test/parseValue-numfmt.spec.ts b/test/parseValue-numfmt.spec.ts index 0caaf07..6a72c92 100644 --- a/test/parseValue-numfmt.spec.ts +++ b/test/parseValue-numfmt.spec.ts @@ -693,7 +693,7 @@ describe('parseValue: NUMFMT mode', () => { expect(!!parsed, `Locale: "${f}" in ${l} (${o})`).toBeTruthy(); } // locales with preferMDY should allow dates that fit, else only allow DMY - const MDY = getLocale(l)?.preferMDY; + const MDY = !getLocale(l)?.format?.dateOrder; if (MDY) { expect(parseDate('07/05/82', opt), `${l} prefers MDY (07/05/82)`).toEqual({ v: 30137, z: 'mm/dd/yy' }); expect(parseDate('31/05/82', opt), `${l} prefers MDY (31/05/82)`).toEqual(undefined); From 5361029715d0ef8870e225ca752a8827ba36e60f Mon Sep 17 00:00:00 2001 From: Borgar Date: Sat, 3 Oct 2026 17:29:05 +0000 Subject: [PATCH 4/4] A bit of cleanup --- lib/constants.ts | 2 - lib/locale.ts | 2 +- lib/locales.ts | 442 ++++++++++++++++++++++++----------------------- lib/runPart.ts | 6 - 4 files changed, 227 insertions(+), 225 deletions(-) diff --git a/lib/constants.ts b/lib/constants.ts index 3593f4e..9ea28d9 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -170,5 +170,3 @@ export const currencySymbols = [ '₾', '₿' ]; - -// export const reCurrencySymbols = new RegExp('[' + currencySymbols.join('') + ']'); diff --git a/lib/locale.ts b/lib/locale.ts index 8d85da2..bc308d5 100644 --- a/lib/locale.ts +++ b/lib/locale.ts @@ -197,7 +197,7 @@ export type LocaleData = { * should be title-cased English equivalents (`Black`). * @default {black:"Black", white:"White", red:"Red", green:"Green", blue:"Blue", yellow:"Yellow", magenta:"Magenta", cyan:"Cyan"} */ - colors?: Record; + colors?: Record; /** * Operator symbol map.This is a record of characters, one for each operator. The value should * be single character lower case strings. Keys are as follows: diff --git a/lib/locales.ts b/lib/locales.ts index 7ddaf31..4c85800 100644 --- a/lib/locales.ts +++ b/lib/locales.ts @@ -95,6 +95,16 @@ const xf = (p: CompressedFormat): Required => { }; }; +type Colors = Record; +const C_BLACK = 'Black'; +const C_WHITE = 'White'; +const C_RED = 'Red'; +const C_GREEN = 'Green'; +const C_BLUE = 'Blue'; +const C_YELLOW = 'Yellow'; +const C_MAGENTA = 'Magenta'; +const C_CYAN = 'Cyan'; + const fp1: CompressedFormat = { k: '.', l: '.' }; const fp2: CompressedFormat = { d: 0, h: 0, m: 0, k: '.', l: '.' }; const fp3: CompressedFormat = { d: 1, y: 1, f: 0, o: 1, k: '-', b: ':', s: 1 }; @@ -103,15 +113,15 @@ const fp5: CompressedFormat = { h: 0, d: 0, f: 0, m: 0, s: 1 }; export function initLocales () { const _zhM4 = _M('一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月'); - const _zhCl = { - 黑色: 'Black', - 白色: 'White', - 紅色: 'Red', - 綠色: 'Green', - 藍色: 'Blue', - 黃色: 'Yellow', - 洋紅: 'Magenta', - 青色: 'Cyan' + const _zhCl: Colors = { + 黑色: C_BLACK, + 白色: C_WHITE, + 紅色: C_RED, + 綠色: C_GREEN, + 藍色: C_BLUE, + 黃色: C_YELLOW, + 洋紅: C_MAGENTA, + 青色: C_CYAN }; addLocale({ group: ',', @@ -122,14 +132,14 @@ export function initLocales () { ddd: _W('周日;周一;周二;周三;周四;周五;周六'), color: '颜色', colors: { - 黑色: 'Black', - 白色: 'White', - 红色: 'Red', - 绿色: 'Green', - 蓝色: 'Blue', - 黄色: 'Yellow', - 洋红: 'Magenta', - 蓝绿色: 'Cyan' + 黑色: C_BLACK, + 白色: C_WHITE, + 红色: C_RED, + 绿色: C_GREEN, + 蓝色: C_BLUE, + 黄色: C_YELLOW, + 洋红: C_MAGENTA, + 蓝绿色: C_CYAN }, general: 'G/通用格式', currency: '¥', @@ -173,14 +183,14 @@ export function initLocales () { currency: '¥', color: '色', colors: { - 黒: 'Black', - 白: 'White', - 赤: 'Red', - 緑: 'Green', - 青: 'Blue', - 黄: 'Yellow', - 紫: 'Magenta', - 水: 'Cyan' + 黒: C_BLACK, + 白: C_WHITE, + 赤: C_RED, + 緑: C_GREEN, + 青: C_BLUE, + 黄: C_YELLOW, + 紫: C_MAGENTA, + 水: C_CYAN }, format: xf({ h: 0, f: 0, o: 2, d: 1 }) }, 'ja'); @@ -194,14 +204,14 @@ export function initLocales () { ddd: _W('일;월;화;수;목;금;토'), color: '색', colors: { - 검정: 'Black', - 흰색: 'White', - 빨강: 'Red', - 녹색: 'Green', - 파랑: 'Blue', - 노랑: 'Yellow', - 자홍: 'Magenta', - 녹청: 'Cyan' + 검정: C_BLACK, + 흰색: C_WHITE, + 빨강: C_RED, + 녹색: C_GREEN, + 파랑: C_BLUE, + 노랑: C_YELLOW, + 자홍: C_MAGENTA, + 녹청: C_CYAN }, general: 'G/표준', currency: '₩', @@ -217,14 +227,14 @@ export function initLocales () { ddd: _W('อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.'), color: 'สี', colors: { - ดำ: 'Black', - ขาว: 'White', - แดง: 'Red', - เขียว: 'Green', - น้ำเงิน: 'Blue', - เหลือง: 'Yellow', - ม่วงมาเจนต้า: 'Magenta', - ฟ้า: 'Cyan' + ดำ: C_BLACK, + ขาว: C_WHITE, + แดง: C_RED, + เขียว: C_GREEN, + น้ำเงิน: C_BLUE, + เหลือง: C_YELLOW, + ม่วงมาเจนต้า: C_MAGENTA, + ฟ้า: C_CYAN }, currency: '฿', format: xf({ h: 0, d: 0, f: 0, m: 0, o: 1 }) @@ -239,14 +249,14 @@ export function initLocales () { bool: _B('PRAVDA;NEPRAVDA'), color: 'Barva', colors: { - černá: 'Black', - bílá: 'White', - červená: 'Red', - zelená: 'Green', - modrá: 'Blue', - žlutá: 'Yellow', - purpurová: 'Magenta', - azurová: 'Cyan' + černá: C_BLACK, + bílá: C_WHITE, + červená: C_RED, + zelená: C_GREEN, + modrá: C_BLUE, + žlutá: C_YELLOW, + purpurová: C_MAGENTA, + azurová: C_CYAN }, general: 'Všeobecný', opcodes: { dy: 'r' }, @@ -262,14 +272,14 @@ export function initLocales () { bool: _B('SAND;FALSK'), color: 'Farve', colors: { - sort: 'Black', - hvid: 'White', - rød: 'Red', - lysegrøn: 'Green', - blå: 'Blue', - gul: 'Yellow', - lyslilla: 'Magenta', - akvamarin: 'Cyan' + sort: C_BLACK, + hvid: C_WHITE, + rød: C_RED, + lysegrøn: C_GREEN, + blå: C_BLUE, + gul: C_YELLOW, + lyslilla: C_MAGENTA, + akvamarin: C_CYAN }, general: 'Standard', opcodes: { dy: 'å', th: 't' }, @@ -286,15 +296,15 @@ export function initLocales () { bool: _B('WAAR;ONWAAR'), color: 'Kleur', colors: { - zwart: 'Black', - wit: 'White', - rood: 'Red', // mac - root: 'Red', // win? - groen: 'Green', - blauw: 'Blue', - geel: 'Yellow', - magenta: 'Magenta', - cyaan: 'Cyan' + zwart: C_BLACK, + wit: C_WHITE, + rood: C_RED, // mac + root: C_RED, // win? + groen: C_GREEN, + blauw: C_BLUE, + geel: C_YELLOW, + magenta: C_MAGENTA, + cyaan: C_CYAN }, general: 'Standaard', opcodes: { dy: 'j', th: 'u' }, @@ -326,14 +336,14 @@ export function initLocales () { bool: _B('TOSI;EPÄTOSI'), color: 'Väri', colors: { - musta: 'Black', - valkoinen: 'White', - punainen: 'Red', - vihreä: 'Green', - sininen: 'Blue', - keltainen: 'Yellow', - magenta: 'Magenta', - syaani: 'Cyan' + musta: C_BLACK, + valkoinen: C_WHITE, + punainen: C_RED, + vihreä: C_GREEN, + sininen: C_BLUE, + keltainen: C_YELLOW, + magenta: C_MAGENTA, + syaani: C_CYAN }, general: 'Yleinen', currency: '€', @@ -351,14 +361,14 @@ export function initLocales () { bool: _B('VRAI;FAUX'), color: 'Couleur', colors: { - noir: 'Black', - blanc: 'White', - rouge: 'Red', - vert: 'Green', - bleu: 'Blue', - jaune: 'Yellow', - magenta: 'Magenta', - cyan: 'Cyan' + noir: C_BLACK, + blanc: C_WHITE, + rouge: C_RED, + vert: C_GREEN, + bleu: C_BLUE, + jaune: C_YELLOW, + magenta: C_MAGENTA, + cyan: C_CYAN }, opcodes: { dy: 'a', dd: 'j', wd: 'o' }, general: 'Standard' @@ -374,14 +384,14 @@ export function initLocales () { bool: _B('WAHR;FALSCH'), color: 'Farbe', colors: { - schwarz: 'Black', - weiß: 'White', - rot: 'Red', - grün: 'Green', - blau: 'Blue', - gelb: 'Yellow', - magenta: 'Magenta', - zyan: 'Cyan' + schwarz: C_BLACK, + weiß: C_WHITE, + rot: C_RED, + grün: C_GREEN, + blau: C_BLUE, + gelb: C_YELLOW, + magenta: C_MAGENTA, + zyan: C_CYAN }, opcodes: { dy: 'j', dd: 't' }, general: 'Standard' @@ -398,14 +408,14 @@ export function initLocales () { dddd: _W('Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο'), ddd: [ 'Κυρ', 'Δευ', 'Τρι', 'Τετ', 'Πεμ', 'Παρ', 'Σαβ' ], colors: { - μαύρο: 'Black', - λευκό: 'White', - κόκκινο: 'Red', - πράσινο: 'Green', - μπλε: 'Blue', - κίτρινο: 'Yellow', - ματζέντα: 'Magenta', - γαλάζιο: 'Cyan' + μαύρο: C_BLACK, + λευκό: C_WHITE, + κόκκινο: C_RED, + πράσινο: C_GREEN, + μπλε: C_BLUE, + κίτρινο: C_YELLOW, + ματζέντα: C_MAGENTA, + γαλάζιο: C_CYAN }, general: 'Γενικός τύπος', color: 'Χρώμα', @@ -426,14 +436,14 @@ export function initLocales () { general: 'Normál', opcodes: { dy: 'é', dm: 'h', dd: 'n', th: 'ó', tm: 'p', ts: 'm' }, colors: { - fekete: 'Black', - fehér: 'White', - piros: 'Red', - zöld: 'Green', - kék: 'Blue', - sárga: 'Yellow', - bíbor: 'Magenta', - ciánkék: 'Cyan' + fekete: C_BLACK, + fehér: C_WHITE, + piros: C_RED, + zöld: C_GREEN, + kék: C_BLUE, + sárga: C_YELLOW, + bíbor: C_MAGENTA, + ciánkék: C_CYAN }, color: 'Szín', format: xf({ h: 0, o: 2, k: '.', l: '.', d: 1 }) @@ -458,14 +468,14 @@ export function initLocales () { ddd: _W('Mgg;Sen;Sel;Rab;Kam;Jum;Sab'), color: 'Warna', colors: { - hitam: 'Black', - putih: 'White', - merah: 'Red', - hijau: 'Green', - biru: 'Blue', - kuning: 'Yellow', - magenta: 'Magenta', - sian: 'Cyan' + hitam: C_BLACK, + putih: C_WHITE, + merah: C_RED, + hijau: C_GREEN, + biru: C_BLUE, + kuning: C_YELLOW, + magenta: C_MAGENTA, + sian: C_CYAN }, currency: 'Rp', format: xf({ f: 0, b: '.' }) @@ -478,15 +488,15 @@ export function initLocales () { general: 'Standard', color: 'Colore', colors: { - nero: 'Black', - bianco: 'White', - rosso: 'Red', - verde: 'Green', - blu: 'Blue', - giallo: 'Yellow', - fucsia: 'Magenta', - celeste: 'Cyan', // mac - ciano: 'Cyan' // win + nero: C_BLACK, + bianco: C_WHITE, + rosso: C_RED, + verde: C_GREEN, + blu: C_BLUE, + giallo: C_YELLOW, + fucsia: C_MAGENTA, + celeste: C_CYAN, // mac + ciano: C_CYAN // win }, opcodes: { dy: 'a', dd: 'g', wd: 'o', en: 'x' } }, 3, 3); @@ -502,15 +512,15 @@ export function initLocales () { bool: _B('SANN;USANN'), color: 'Farge', colors: { - svart: 'Black', - hvit: 'White', - rød: 'Red', - grønn: 'Green', - blå: 'Blue', - gul: 'Yellow', - magenta: 'Magenta', - cyan: 'Cyan' - }, + svart: C_BLACK, + hvit: C_WHITE, + rød: C_RED, + grønn: C_GREEN, + blå: C_BLUE, + gul: C_YELLOW, + magenta: C_MAGENTA, + cyan: C_CYAN + } as Colors, general: 'Standard', opcodes: { dy: 'å', th: 't' }, currency: 'kr' @@ -526,14 +536,14 @@ export function initLocales () { bool: _B('PRAWDA;FAŁSZ'), color: 'Kolor', colors: { - czarny: 'Black', - biały: 'White', - czerwony: 'Red', - zielony: 'Green', - niebieski: 'Blue', - żółty: 'Yellow', - amarantowy: 'Magenta', - błękitny: 'Cyan' + czarny: C_BLACK, + biały: C_WHITE, + czerwony: C_RED, + zielony: C_GREEN, + niebieski: C_BLUE, + żółty: C_YELLOW, + amarantowy: C_MAGENTA, + błękitny: C_CYAN }, general: 'Standardowy', opcodes: { dy: 'r', th: 'g' }, @@ -554,15 +564,15 @@ export function initLocales () { group: '\u202f', general: 'Estandar', colors: { - preto: 'Black', - branco: 'White', - vermelho: 'Red', - verde: 'Green', - azul: 'Blue', - amarelo: 'Yellow', - magenta: 'Magenta', - turquesa: 'Cyan', // mac - ciano: 'Cyan' // pc + preto: C_BLACK, + branco: C_WHITE, + vermelho: C_RED, + verde: C_GREEN, + azul: C_BLUE, + amarelo: C_YELLOW, + magenta: C_MAGENTA, + turquesa: C_CYAN, // mac + ciano: C_CYAN // pc }, currency: '€', format: xf({ l: '/' }) @@ -572,14 +582,14 @@ export function initLocales () { group: '.', general: 'Geral', colors: { - preto: 'Black', - branco: 'White', - vermelho: 'Red', - verde: 'Green', - azul: 'Blue', - amarelo: 'Yellow', - magenta: 'Magenta', - ciano: 'Cyan' + preto: C_BLACK, + branco: C_WHITE, + vermelho: C_RED, + verde: C_GREEN, + azul: C_BLUE, + amarelo: C_YELLOW, + magenta: C_MAGENTA, + ciano: C_CYAN }, currency: 'R$', format: xf({ f: 2, l: '/' }) @@ -599,15 +609,15 @@ export function initLocales () { opcodes: { dy: 'г', dm: 'м', dd: 'д', th: 'ч', tm: 'м', ts: 'с' }, color: 'Цвет', colors: { - черный: 'Black', - белый: 'White', - красный: 'Red', - зеленый: 'Green', - синий: 'Blue', - желтый: 'Yellow', - фиолетовый: 'Magenta', // mac - пурпурный: 'Magenta', // win - голубой: 'Cyan' + черный: C_BLACK, + белый: C_WHITE, + красный: C_RED, + зеленый: C_GREEN, + синий: C_BLUE, + желтый: C_YELLOW, + фиолетовый: C_MAGENTA, // mac + пурпурный: C_MAGENTA, // win + голубой: C_CYAN }, currency: '₽', format: xf({ h: 0, k: '.', l: '.' }) @@ -620,14 +630,14 @@ export function initLocales () { dddd: _W('nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota'), color: 'Farba', colors: { - čierna: 'Black', - biela: 'White', - červená: 'Red', - zelená: 'Green', - modrá: 'Blue', - žltá: 'Yellow', - purpurová: 'Magenta', - azúrová: 'Cyan' + čierna: C_BLACK, + biela: C_WHITE, + červená: C_RED, + zelená: C_GREEN, + modrá: C_BLUE, + žltá: C_YELLOW, + purpurová: C_MAGENTA, + azúrová: C_CYAN }, currency: '€', format: xf(fp2) @@ -643,16 +653,16 @@ export function initLocales () { ddd: _W('dom;lun;mar;mié;jue;vie;sáb'), bool: _B('VERDADERO;FALSO'), colors: { - negro: 'Black', - blanco: 'White', - rojo: 'Red', - verde: 'Green', - azul: 'Blue', - amarillo: 'Yellow', - magenta: 'Magenta', - cian: 'Cyan', // mac - ciano: 'Cyan' // pc - } + negro: C_BLACK, + blanco: C_WHITE, + rojo: C_RED, + verde: C_GREEN, + azul: C_BLUE, + amarillo: C_YELLOW, + magenta: C_MAGENTA, + cian: C_CYAN, // mac + ciano: C_CYAN // pc + } as Colors }; const _esM3 = _M('ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic'); const _esM3s = _M('ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic'); @@ -696,14 +706,14 @@ export function initLocales () { general: 'Standard', color: 'Färg', colors: { - svart: 'Black', - vit: 'White', - röd: 'Red', - grön: 'Green', - blå: 'Blue', - gul: 'Yellow', - magenta: 'Magenta', - cyanblå: 'Cyan' + svart: C_BLACK, + vit: C_WHITE, + röd: C_RED, + grön: C_GREEN, + blå: C_BLUE, + gul: C_YELLOW, + magenta: C_MAGENTA, + cyanblå: C_CYAN }, currency: 'kr', format: xf({ o: 2, k: '-' }) @@ -720,14 +730,14 @@ export function initLocales () { bool: _B('DOĞRU;YANLIŞ'), color: 'Renk', colors: { - siyah: 'Black', - beyaz: 'White', - kırmızı: 'Red', - yeşil: 'Green', - mavi: 'Blue', - sarı: 'Yellow', - pembe: 'Magenta', - camgöbeği: 'Cyan' + siyah: C_BLACK, + beyaz: C_WHITE, + kırmızı: C_RED, + yeşil: C_GREEN, + mavi: C_BLUE, + sarı: C_YELLOW, + pembe: C_MAGENTA, + camgöbeği: C_CYAN }, opcodes: { dm: 'a', dd: 'g', th: 's', tm: 'd', ts: 'n' }, general: 'Genel', @@ -826,14 +836,14 @@ export function initLocales () { mmm6: _M('רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן'), color: 'צבע', colors: { - 'שחור': 'Black', - 'לבן': 'White', - 'אדום': 'Red', - 'ירוק': 'Green', - 'כחול': 'Blue', - 'צהוב': 'Yellow', - 'אדום ארגמן': 'Magenta', - 'תכלת': 'Cyan' + 'שחור': C_BLACK, + 'לבן': C_WHITE, + 'אדום': C_RED, + 'ירוק': C_GREEN, + 'כחול': C_BLUE, + 'צהוב': C_YELLOW, + 'אדום ארגמן': C_MAGENTA, + 'תכלת': C_CYAN }, currency: '₪', format: xf({ f: 2, s: 1 }) @@ -1054,14 +1064,14 @@ export function initLocales () { mmmm6: _M('رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان'), color: 'اللون', colors: { - أسود: 'Black', - أبيض: 'White', - أحمر: 'Red', - أخضر: 'Green', - أزرق: 'Blue', - أصفر: 'Yellow', - ماجنتا: 'Magenta', - سماوي: 'Cyan' + أسود: C_BLACK, + أبيض: C_WHITE, + أحمر: C_RED, + أخضر: C_GREEN, + أزرق: C_BLUE, + أصفر: C_YELLOW, + ماجنتا: C_MAGENTA, + سماوي: C_CYAN }, currency: '⃁', format: xf({ f: 2, i: 1, y: 1, s: 1 }) diff --git a/lib/runPart.ts b/lib/runPart.ts index bf72325..9223b62 100644 --- a/lib/runPart.ts +++ b/lib/runPart.ts @@ -396,14 +396,8 @@ export function runPart (value: number | string | bigint, part: Partition, opts: : pad('?', opts.nbsp); } } - // if (special_case_zero) { - // console.log([ d ]); - // } digits += (d || pad(p, opts.nbsp)) + sep; } - // if (special_case_zero) { - // digits += `{${l}}`; - // } ret.push(digits); } else {