Files
discord-decomp/lib/intlFormatDate.tsx
T
2026-11-01 12:12:55 +02:00

53 lines
1.5 KiB
TypeScript

// Metro module 3879 (f3880).
import LocaleStore from "../modules/user_settings/LocaleStore";
import * as _SystemDateFormatter_native from "../modules/system_date_format/SystemDateFormatter.native";
import { systemLocale, initialLocale } from "../intl/index.native";
const makeIntlFormatter = function makeIntlFormatter(locale, a1) {
let format;
try {
format = Intl.DateTimeFormat(locale, a1).format;
} catch ($e) {
return Intl.DateTimeFormat(void 0, a1).format;
}
return format;
};
export function makeFormatter(a0) {
let r7 = (function tryMakeNativeFormatter(a0, a1) {
let c24873_2, c24873_3;
let c24873_0 = a0;
if (_SystemDateFormatter_native.makeFormatter == null) {
return null;
}
L11: {
try {
const r17 = a0 != null && a0.split("-")[0] === (systemLocale == null ? void 0 : systemLocale.split("-")[0]);
const r32 = _SystemDateFormatter_native.makeFormatter(a0 === initialLocale ? r17 ? void 0 : a0 : a0, a1);
c24873_2 = r32;
if (r32 == null) {
break L11;
}
c24873_3 = null;
} catch ($e) {
return null;
}
return function(a0) {
let r6;
try {
r6 = c24873_2(a0);
} catch ($e) {
if (c24873_3 == null) {
c24873_3 = makeIntlFormatter(c24873_0, a1);
}
return c24873_3(a0);
}
return r6;
};
}
return null;
})(LocaleStore.locale, a0);
if (r7 == null) {
r7 = makeIntlFormatter(LocaleStore.locale, a0);
}
return r7;
}