- Create unified date/time formatter with Intl-first approach and dayjs fallback - Add support for is/lt/nb locales in Booker components - Unify date formatting across Booker (Header, dates, weekdays) - Update translation pipeline to include is, lt, nb - Add tests for new locales and formatter - Add timezone support in dayjs fallback - Add formatter caching with circuit breaker - Use unified formatDateTime in Header.tsx
18 lines
617 B
TypeScript
18 lines
617 B
TypeScript
import { getWeekdayNames, formatWeekday } from "./dateTimeFormatter";
|
|
|
|
type WeekdayFormat = "short" | "long";
|
|
|
|
export function weekdayNames(locale: string | string[], weekStart = 0, format: WeekdayFormat = "long") {
|
|
const normalizedLocale = Array.isArray(locale) ? locale[0] : locale || "en";
|
|
return getWeekdayNames(normalizedLocale, weekStart, format);
|
|
}
|
|
|
|
export function nameOfDay(
|
|
locale: string | string[] | undefined,
|
|
day: number,
|
|
format: WeekdayFormat = "long"
|
|
) {
|
|
const normalizedLocale = Array.isArray(locale) ? locale[0] : locale || "en";
|
|
return formatWeekday(normalizedLocale, day, format);
|
|
}
|