Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 55x 14x 14x 3356x | // Prefer Temporal and Intl APIs to dayjs, they're richer and safer.
// We still need dayjs for:
// - The MUI locale adapter needed for date/time pickers.
// - Formatting durations ("5 minutes"). Intl.RelativeTimeFormat always adds "in" or "ago".
// Register all locales we support with dayjs.
import "dayjs/locale/ca";
import "dayjs/locale/cs";
import "dayjs/locale/de";
import "dayjs/locale/en-au"; // For our "en" locale (international English)
import "dayjs/locale/es";
import "dayjs/locale/fr";
import "dayjs/locale/he";
import "dayjs/locale/hi";
import "dayjs/locale/hu";
import "dayjs/locale/it";
import "dayjs/locale/ja";
import "dayjs/locale/nb";
import "dayjs/locale/nl";
import "dayjs/locale/pl";
import "dayjs/locale/pt";
import "dayjs/locale/pt-br";
import "dayjs/locale/ru";
import "dayjs/locale/sv";
import "dayjs/locale/tr";
import "dayjs/locale/uk";
import "dayjs/locale/zh-cn";
import "dayjs/locale/zh-tw";
import dayjs, { Dayjs } from "dayjs";
import customParseFormat from "dayjs/plugin/customParseFormat";
import DurationPlugin from "dayjs/plugin/duration";
import LocalizedFormat from "dayjs/plugin/localizedFormat";
import RelativeTime from "dayjs/plugin/relativeTime";
import Timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
dayjs.extend(utc);
dayjs.extend(customParseFormat);
dayjs.extend(DurationPlugin);
dayjs.extend(RelativeTime);
dayjs.extend(Timezone);
dayjs.extend(LocalizedFormat);
// Dayjs-supported locale codes don't map 1:1 with our ISO locales
const DAYJS_LOCALE_REMAP: Record<string, string> = {
// Our "en" is international English (dd/mm/yyyy, 12h clock)
// dayjs doesn't have en-001, but en-au approximates it.
en: "en-au",
// dayjs' "en" locale uses US conventions (mm/dd/yyyy, 12h clock).
"en-US": "en",
"nb-NO": "nb",
"pt-BR": "pt-br",
"zh-Hans": "zh-cn",
"zh-Hant": "zh-tw",
};
/** Maps a supported ISO locale code to the locale name used for formatting with dayjs. */
export function toDayjsLocale(locale: string): string {
return DAYJS_LOCALE_REMAP[locale] ?? locale.toLowerCase();
}
export { Dayjs };
export default dayjs;
|