intl-relativeformat
Version:
Formats JavaScript dates to relative time strings.
69 lines (68 loc) • 1.85 kB
TypeScript
export declare const enum DATA_FIELD {
second = "second",
secondShort = "second-short",
secondNarrow = "second-narrow",
minute = "minute",
minuteShort = "minute-short",
minuteNarrow = "minute-narrow",
hour = "hour",
hourShort = "hour-short",
hourNarrow = "hour-narrow",
day = "day",
dayShort = "day-short",
dayNarrow = "day-narrow",
week = "week",
weekShort = "week-short",
weekNarrow = "week-narrow",
month = "month",
monthShort = "month-short",
monthNarrow = "month-narrow",
quarter = "quarter",
quarterShort = "quarter-short",
quarterNarrow = "quarter-narrow",
year = "year",
yearShort = "year-short",
yearNarrow = "year-narrow"
}
export declare const enum SUPPORTED_FIELD {
second = "second",
secondShort = "second-short",
secondNarrow = "second-narrow",
minute = "minute",
minuteShort = "minute-short",
minuteNarrow = "minute-narrow",
hour = "hour",
hourShort = "hour-short",
hourNarrow = "hour-narrow",
day = "day",
dayShort = "day-short",
dayNarrow = "day-narrow",
week = "week",
weekShort = "week-short",
weekNarrow = "week-narrow",
month = "month",
monthShort = "month-short",
monthNarrow = "month-narrow",
year = "year",
yearShort = "year-short",
yearNarrow = "year-narrow"
}
export declare const enum STYLE {
bestFit = "best fit",
numeric = "numeric"
}
export interface LocaleData {
locale: string;
parentLocale?: string;
fields?: {
[f in DATA_FIELD]: {
displayName: string;
relative: Record<string, string>;
relativePeriod?: string;
relativeTime: {
future: Record<string, string>;
past: Record<string, string>;
};
};
};
}