@scaleway/use-i18n
Version:
A small hook to handle i18n
44 lines (43 loc) • 1.4 kB
TypeScript
declare const formatOptions: {
readonly second: {
readonly day: "numeric";
readonly month: "long";
readonly year: "numeric";
readonly hour: "numeric";
readonly minute: "numeric";
readonly second: "numeric";
};
readonly hour: {
readonly day: "numeric";
readonly hour: "numeric";
readonly minute: "numeric";
readonly month: "long";
readonly year: "numeric";
};
readonly hourOnly: {
readonly hour: "numeric";
readonly minute: "numeric";
};
readonly long: {
readonly day: "numeric";
readonly month: "long";
readonly year: "numeric";
};
readonly short: {
readonly day: "numeric";
readonly month: "short";
readonly year: "numeric";
};
readonly shortWithoutDay: {
readonly month: "short";
readonly year: "numeric";
};
};
declare const complexFormatOptions: {
readonly numeric: (date: Date) => string;
readonly numericHour: (date: Date, locale: string) => string;
};
export declare const supportedFormats: string[];
export type FormatDateOptions = keyof typeof formatOptions | keyof typeof complexFormatOptions | Intl.DateTimeFormatOptions;
declare const formatDate: (locale: string, date: Date | number | string, format?: FormatDateOptions) => string;
export default formatDate;