decord/stable/source/lib/intlFormatDate.tsx

75 lines
2 KiB
TypeScript
Raw Permalink Normal View History

2026-10-06 22:12:49 +00:00
// Module ID: 4521
// Function ID: 4522
// Name: intlFormatDate
2026-10-06 22:12:49 +00:00
// Dependencies: [2115, 4518, 1127, 2]
// Exports: makeFormatter
2026-10-06 22:12:49 +00:00
// Module 4521 (intlFormatDate)
import LocaleStore from "LocaleStore" /* 2115 */;
import size from "module_2" /* 2 */;
function makeIntlFormatter(locale, arg1) {
try {
const _Intl = Intl;
return Intl.DateTimeFormat(locale, arg1).format;
} catch (err) {
const _Intl2 = Intl;
2026-10-06 22:12:49 +00:00
return Intl.DateTimeFormat(undefined, arg1).format;
}
}
const result = size.fileFinishedImporting("lib/intlFormatDate.tsx");
export const makeFormatter = function makeFormatter(arg0) {
2026-10-06 22:12:49 +00:00
function tryMakeNativeFormatter(locale, arg1) {
let closure_0 = locale;
let closure_1 = arg1;
if (null == closure_0(closure_1[1]).makeFormatter) {
return null;
} else {
try {
2026-10-06 22:12:49 +00:00
let tmp8;
let tmp3 = null != locale;
if (tmp3) {
const first = locale.split("-")[0];
const str2 = closure_0(closure_1[2]).systemLocale;
let first1;
if (str2 != null) {
2026-10-06 22:12:49 +00:00
first1 = str2.split("-")[0];
}
2026-10-06 22:12:49 +00:00
tmp3 = first === first1;
}
2026-10-06 22:12:49 +00:00
const makeFormatter = tmp(tmp2[1]).makeFormatter;
closure_0(closure_1[1]);
if (locale !== closure_0(closure_1[2]).initialLocale) {
tmp8 = locale;
}
2026-10-06 22:12:49 +00:00
const formatter = makeFormatter(tmp8, arg1);
if (null == formatter) {
return null;
} else {
2026-10-06 22:12:49 +00:00
let closure_3 = null;
return (arg0) => {
try {
return formatter(arg0);
} catch (err) {
if (null == closure_3) {
2026-10-06 22:12:49 +00:00
closure_3 = makeIntlFormatter(locale, closure_1);
}
2026-10-06 22:12:49 +00:00
return closure_3(arg0);
}
};
}
} catch (err) {
2026-10-06 22:12:49 +00:00
return null;
}
}
2026-10-06 22:12:49 +00:00
}
const locale = LocaleStore.locale;
let tmp = tryMakeNativeFormatter(locale, arg0);
if (null == tmp) {
2026-10-06 22:12:49 +00:00
const tmp2 = makeIntlFormatter;
tmp = makeIntlFormatter(locale, arg0);
}
return tmp;
};