calendar display type supports Gregorian with Chinese

This commit is contained in:
MaysWind
2025-09-06 01:06:31 +08:00
parent e15a5617e6
commit 8368b02be8
45 changed files with 38451 additions and 43 deletions
+11 -1
View File
@@ -2,7 +2,16 @@ import type { TypeAndName } from '@/core/base.ts';
export enum CalendarType {
Gregorian = 0,
Buddhist = 1
Buddhist = 1,
Chinese = 2
}
export interface ChineseCalendarLocaleData {
readonly numerals: string[];
readonly monthNames: string[];
readonly dayNames: string[];
readonly leapMonthPrefix: string;
readonly solarTermNames: string[];
}
export class CalendarDisplayType implements TypeAndName {
@@ -13,6 +22,7 @@ export class CalendarDisplayType implements TypeAndName {
public static readonly LanguageDefaultType: number = 0;
public static readonly Gregorian = new CalendarDisplayType(1, 'Gregorian', 'Gregorian', CalendarType.Gregorian);
public static readonly Buddhist = new CalendarDisplayType(2, 'Buddhist', 'Buddhist', CalendarType.Buddhist);
public static readonly GregorianWithChinese = new CalendarDisplayType(3, 'GregorianWithChinese', 'Gregorian with Chinese', CalendarType.Gregorian, CalendarType.Chinese);
public static readonly Default = CalendarDisplayType.Gregorian;
+6 -2
View File
@@ -1,5 +1,5 @@
import type { TypeAndName, TypeAndDisplayName } from '@/core/base.ts';
import type { CalendarType } from '@/core/calendar.ts';
import type { CalendarType, ChineseCalendarLocaleData } from '@/core/calendar.ts';
import type { NumeralSystem } from '@/core/numeral.ts';
export interface DateTime {
@@ -12,7 +12,6 @@ export interface DateTime {
getGregorianCalendarMonthDisplayName(options: DateTimeFormatOptions): string;
getGregorianCalendarMonthDisplayShortName(options: DateTimeFormatOptions): string;
getLocalizedCalendarMonth(options: DateTimeFormatOptions): string;
getLocalizedCalendarMonthIndex(options: DateTimeFormatOptions): number;
getLocalizedCalendarMonthDisplayName(options: DateTimeFormatOptions): string;
getLocalizedCalendarMonthDisplayShortName(options: DateTimeFormatOptions): string;
getGregorianCalendarDay(): number;
@@ -37,6 +36,7 @@ export interface DateTimeFormatOptions {
numeralSystem: NumeralSystem;
calendarType: CalendarType;
localeData: DateTimeLocaleData;
chineseCalendarLocaleData: ChineseCalendarLocaleData;
}
export interface DateTimeLocaleData {
@@ -82,6 +82,10 @@ export interface MonthDay {
readonly day: number;
}
export interface CalendarAlternateDate extends YearMonthDay {
readonly displayDate: string;
}
export interface TimeRange {
readonly minTime: number;
readonly maxTime: number;