fix the Persian Calendar was not displayed when the calendar display type was set to Gregorian with Persian Calendar, but the date display type was not set to Persian

This commit is contained in:
MaysWind
2025-10-15 23:10:36 +08:00
parent 130a157abc
commit 7938e7c7c8
+4 -2
View File
@@ -1905,6 +1905,8 @@ export function useI18n() {
return undefined; return undefined;
} }
const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: calendarDisplayType });
if (calendarDisplayType === CalendarType.Chinese) { if (calendarDisplayType === CalendarType.Chinese) {
const chineseCalendarLocaleData = getChineseCalendarLocaleData(); const chineseCalendarLocaleData = getChineseCalendarLocaleData();
const chineseDates: ChineseYearMonthDayInfo[] | undefined = getChineseYearMonthAllDayInfos(yearMonth, chineseCalendarLocaleData); const chineseDates: ChineseYearMonthDayInfo[] | undefined = getChineseYearMonthAllDayInfos(yearMonth, chineseCalendarLocaleData);
@@ -1922,7 +1924,6 @@ export function useI18n() {
return ret; return ret;
} else if (calendarDisplayType === CalendarType.Persian) { } else if (calendarDisplayType === CalendarType.Persian) {
const dateTimeFormatOptions = getDateTimeFormatOptions();
const monthDays: number = getGregorianCalendarYearMonthDays(yearMonth); const monthDays: number = getGregorianCalendarYearMonthDays(yearMonth);
const ret: CalendarAlternateDate[] = []; const ret: CalendarAlternateDate[] = [];
@@ -1944,6 +1945,8 @@ export function useI18n() {
return undefined; return undefined;
} }
const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: calendarDisplayType });
if (calendarDisplayType === CalendarType.Chinese) { if (calendarDisplayType === CalendarType.Chinese) {
const chineseCalendarLocaleData = getChineseCalendarLocaleData(); const chineseCalendarLocaleData = getChineseCalendarLocaleData();
const chineseDate: ChineseYearMonthDayInfo | undefined = getChineseYearMonthDayInfo(yearMonthDay, chineseCalendarLocaleData); const chineseDate: ChineseYearMonthDayInfo | undefined = getChineseYearMonthDayInfo(yearMonthDay, chineseCalendarLocaleData);
@@ -1954,7 +1957,6 @@ export function useI18n() {
return getChineseCalendarAlternateDisplayDate(chineseDate); return getChineseCalendarAlternateDisplayDate(chineseDate);
} else if (calendarDisplayType === CalendarType.Persian) { } else if (calendarDisplayType === CalendarType.Persian) {
const dateTimeFormatOptions = getDateTimeFormatOptions();
const dateTime = getYearMonthDayDateTime(yearMonthDay.year, yearMonthDay.month, yearMonthDay.day); const dateTime = getYearMonthDayDateTime(yearMonthDay.year, yearMonthDay.month, yearMonthDay.day);
return getCalendarAlternateDisplayDate(dateTime, dateTimeFormatOptions); return getCalendarAlternateDisplayDate(dateTime, dateTimeFormatOptions);
} }