Files
admin/packages/services/intl-date/src/lib/language.ts
T
2026-06-25 15:53:49 +03:00

19 lines
580 B
TypeScript

import type { Locale } from 'date-fns';
import * as locales from 'date-fns/locale';
import type { IntlDateDisplayFormatEnum } from '../constants';
export type IntlDateLocaleCode = keyof typeof locales;
export type IntlDateLanguage = string;
export type IntlDateLocaleMap = Partial<Record<IntlDateLanguage, IntlDateLocaleConfig>>;
export type IntlDateLocaleConfig = {
code: IntlDateLocaleCode;
locale?: Locale;
displayFormats?: Partial<Record<IntlDateDisplayFormatEnum, string>>;
};
export function getLocale(lang: IntlDateLocaleCode): Locale {
return locales[lang];
}