@wix/design-system
Version:
@wix/design-system
100 lines • 4.09 kB
TypeScript
export declare const languages: {
readonly ar: "ar";
readonly bg: "bg";
readonly cs: "cs";
readonly da: "da";
readonly de: "de";
readonly el: "el";
readonly en: "en";
readonly es: "es";
readonly fi: "fi";
readonly fr: "fr";
readonly he: "he";
readonly hi: "hi";
readonly hu: "hu";
readonly id: "id";
readonly it: "it";
readonly ja: "ja";
readonly ko: "ko";
readonly lt: "lt";
readonly lv: "lv";
readonly ms: "ms";
readonly nl: "nl";
readonly no: "no";
readonly pl: "pl";
readonly pt: "pt";
readonly ro: "ro";
readonly ru: "ru";
readonly sv: "sv";
readonly th: "th";
readonly tl: "tl";
readonly tr: "tr";
readonly uk: "uk";
readonly vi: "vi";
readonly zh: "zh";
};
export declare const MONTHS_INDEXES: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
export declare const CAPITALIZED_MONTH_LANGUAGES: (keyof typeof languages)[];
export declare const WEEKDAY_NARROW_FORMAT_LANGUAGES: Partial<Record<keyof typeof languages, keyof typeof languages>>;
export type WeekdayNumber = 0 | 1 | 2 | 3 | 4 | 5 | 6;
export declare const FIRST_WEEKDAY: Partial<Record<keyof typeof languages, WeekdayNumber>>;
export declare function capitalizeFirstLetter(str: string | undefined): string | undefined;
export declare const capitalizeMonth: (month: string, language: keyof typeof languages) => string | undefined;
declare const _default: (locale: string, firstDayOfWeek?: WeekdayNumber) => {
/**
* This method is required by the ReactDayPicker LocaleUtils API but is not really used since we are using our own CaptionElement - DatePickerHead component.
*
* Return the string used to format the month’s title for the given month. e.g ‘December 2021’
* @param date - a given date
*/
formatMonthTitle: (date: Date | number) => string | undefined;
/**
* Return the string used to format the month and year title for the given date. e.g ‘December 2021’
* @param date - a given date
* @returns - the month and year
*/
formatMonthAndYear: (date: Date | number) => string | undefined;
/**
* Return the string used to format the months range for the given dates. E.g ‘Dec - Jan 2022’
* @param firstDate - first date in the range
* @param secondDate - last date in the range
* @returns the months range for the given dates
*/
formatMonthsRange: (firstDate: Date | number, secondDate: Date | number) => string;
/**
* Return the string used to render the weekday’s short name, e.g. ‘Mon’ for Monday.
* @param index - a weekday index, from 0 to 6 (Sunday to Saturday)
* @returns - a weekday in short format
*/
formatWeekdayShort: (index: number) => string;
/**
* Return the string used to render the weekday’s long name (starting from 0 as Sunday). e.g. ‘Monday’.
* @param index - a weekday index, from 0 to 6 (Sunday to Saturday)
* @returns - a weekday in long format
*/
formatWeekdayLong: (index: WeekdayNumber) => string;
/**
* Format the string used as aria-label for the given day.
* @param date: Date - a given day
* @returns - formatted string that is used as aria-label for the given day
*/
formatDay: (date: Date | number) => string;
/**
* Return an array with the twelve months for the given locale
* @returns - an array with all the translated months strings
*/
getMonths: () => (string | undefined)[];
/**
* Return the first day of week. Currently the default value is 1 which means Monday.
* @returns - a number between 0 to 6 (Sunday to Saturday) which represent the week day
*/
getFirstDayOfWeek: () => WeekdayNumber;
/**
* Return the string used to format the year for the given date. E.g ‘2023年’
* @param date - a given date
* @returns - the string of the given date
* */
formatYear: (date: Date | number) => string;
};
export default _default;
//# sourceMappingURL=LocaleUtils.d.ts.map