fix: add Icelandic, Lithuanian, and Norwegian locale support for Booker (#25519)
- 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
This commit is contained in:
1 parent
aaf5958b7d
commit
1e67f98970
8 files changed
+516
-18
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { formatDateTime, formatDateTimeRange } from "@calcom/lib/dateTimeFormatter";
|
||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||
|
||||
interface EventFromToTime {
|
||||
@@ -17,16 +18,19 @@ interface EventFromTime {
|
||||
|
||||
export const formatEventFromTime = ({ date, timeFormat, timeZone, language }: EventFromTime) => {
|
||||
const startDate = new Date(date);
|
||||
const formattedDate = new Intl.DateTimeFormat(language, {
|
||||
|
||||
const formattedDate = formatDateTime(startDate, {
|
||||
locale: language,
|
||||
timeZone,
|
||||
dateStyle: "full",
|
||||
}).format(startDate);
|
||||
});
|
||||
|
||||
const formattedTime = new Intl.DateTimeFormat(language, {
|
||||
const formattedTime = formatDateTime(startDate, {
|
||||
locale: language,
|
||||
timeZone,
|
||||
timeStyle: "short",
|
||||
hour12: timeFormat === TimeFormat.TWELVE_HOUR ? true : false,
|
||||
}).format(startDate);
|
||||
hour12: timeFormat === TimeFormat.TWELVE_HOUR,
|
||||
});
|
||||
|
||||
return {
|
||||
date: formattedDate,
|
||||
@@ -49,16 +53,18 @@ export const formatEventFromToTime = ({
|
||||
? new Date(new Date(date).setMinutes(startDate.getMinutes() + duration))
|
||||
: startDate;
|
||||
|
||||
const formattedDate = new Intl.DateTimeFormat(language, {
|
||||
const formattedDate = formatDateTimeRange(startDate, endDate, {
|
||||
locale: language,
|
||||
timeZone,
|
||||
dateStyle: "full",
|
||||
}).formatRange(startDate, endDate);
|
||||
});
|
||||
|
||||
const formattedTime = new Intl.DateTimeFormat(language, {
|
||||
const formattedTime = formatDateTimeRange(startDate, endDate, {
|
||||
locale: language,
|
||||
timeZone,
|
||||
timeStyle: "short",
|
||||
hour12: timeFormat === TimeFormat.TWELVE_HOUR ? true : false,
|
||||
}).formatRange(startDate, endDate);
|
||||
hour12: timeFormat === TimeFormat.TWELVE_HOUR,
|
||||
});
|
||||
|
||||
return {
|
||||
date: formattedDate,
|
||||
|
||||
@@ -30,6 +30,9 @@ const SUPPORTED_LOCALES = [
|
||||
"ja", // Japanese
|
||||
"sv", // Swedish
|
||||
"da", // Danish
|
||||
"is", // Icelandic
|
||||
"lt", // Lithuanian
|
||||
"nb", // Norwegian Bokmål
|
||||
] as const;
|
||||
|
||||
async function processTranslations({
|
||||
|
||||
Reference in new issue
Block a user