Skip to content

Commit 9d498c3

Browse files
authored
fix: add support for calendar format in dayjsLocaleConfigForLanguage of Streami18nOptions (#3205)
1 parent e2f4e06 commit 9d498c3

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

package/src/utils/i18n/Streami18n.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ Dayjs.updateLocale('tr', {
141141
calendar: calendarFormats.tr,
142142
});
143143

144+
export type CalendarFormats = {
145+
lastDay: string;
146+
lastWeek: string;
147+
nextDay: string;
148+
nextWeek: string;
149+
sameDay: string;
150+
sameElse: string;
151+
};
152+
144153
const en_locale = {
145154
formats: {},
146155
months: [
@@ -176,7 +185,7 @@ const supportsTz = (dateTimeParser: unknown): dateTimeParser is TimezoneParser =
176185

177186
type Streami18nOptions = {
178187
DateTimeParser?: DateTimeParserModule;
179-
dayjsLocaleConfigForLanguage?: Partial<ILocale>;
188+
dayjsLocaleConfigForLanguage?: Partial<ILocale & { calendar: CalendarFormats }>;
180189
debug?: boolean;
181190
disableDateTimeTranslations?: boolean;
182191
formatters?: Partial<PredefinedFormatters> & CustomFormatters;

package/src/utils/i18n/calendarFormats.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
type CalendarFormats = {
2-
lastDay: string;
3-
lastWeek: string;
4-
nextDay: string;
5-
nextWeek: string;
6-
sameDay: string;
7-
sameElse: string;
8-
};
1+
import { CalendarFormats } from './Streami18n';
92

103
/**
114
* Calendar formats for different languages.

0 commit comments

Comments
 (0)