mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 15:37:33 +08:00
calendar display type supports Gregorian with Persian, date display type supports Persian calendar
This commit is contained in:
+10
-2
@@ -3,7 +3,8 @@ import type { TypeAndName } from '@/core/base.ts';
|
||||
export enum CalendarType {
|
||||
Gregorian = 0,
|
||||
Buddhist = 1,
|
||||
Chinese = 2
|
||||
Chinese = 2,
|
||||
Persian = 3
|
||||
}
|
||||
|
||||
export interface ChineseCalendarLocaleData {
|
||||
@@ -14,6 +15,11 @@ export interface ChineseCalendarLocaleData {
|
||||
readonly solarTermNames: string[];
|
||||
}
|
||||
|
||||
export interface PersianCalendarLocaleData {
|
||||
readonly monthNames: string[];
|
||||
readonly monthShortNames: string[];
|
||||
}
|
||||
|
||||
export class CalendarDisplayType implements TypeAndName {
|
||||
private static readonly allInstances: CalendarDisplayType[] = [];
|
||||
private static readonly allInstancesByType: Record<number, CalendarDisplayType> = {};
|
||||
@@ -23,6 +29,7 @@ export class CalendarDisplayType implements TypeAndName {
|
||||
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 GregorianWithPersian = new CalendarDisplayType(4, 'GregorianWithPersian', 'Gregorian with Persian', CalendarType.Gregorian, CalendarType.Persian);
|
||||
|
||||
public static readonly Default = CalendarDisplayType.Gregorian;
|
||||
|
||||
@@ -64,7 +71,8 @@ export class DateDisplayType implements TypeAndName {
|
||||
|
||||
public static readonly LanguageDefaultType: number = 0;
|
||||
public static readonly Gregorian = new DateDisplayType(1, 'Gregorian', 'Gregorian', CalendarType.Gregorian);
|
||||
public static readonly Chinese = new DateDisplayType(2, 'Buddhist', 'Buddhist', CalendarType.Buddhist);
|
||||
public static readonly Buddhist = new DateDisplayType(2, 'Buddhist', 'Buddhist', CalendarType.Buddhist);
|
||||
public static readonly Persian = new DateDisplayType(3, 'Persian', 'Persian', CalendarType.Persian);
|
||||
|
||||
public static readonly Default = DateDisplayType.Gregorian;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { TypeAndName, TypeAndDisplayName } from '@/core/base.ts';
|
||||
import type { CalendarType, ChineseCalendarLocaleData } from '@/core/calendar.ts';
|
||||
import type { CalendarType, ChineseCalendarLocaleData, PersianCalendarLocaleData } from '@/core/calendar.ts';
|
||||
import type { NumeralSystem } from '@/core/numeral.ts';
|
||||
|
||||
export interface DateTime {
|
||||
@@ -16,6 +16,7 @@ export interface DateTime {
|
||||
getLocalizedCalendarMonthDisplayShortName(options: DateTimeFormatOptions): string;
|
||||
getGregorianCalendarDay(): number;
|
||||
getLocalizedCalendarDay(options: DateTimeFormatOptions): string;
|
||||
isLocalizedCalendarFirstDayOfMonth(options: DateTimeFormatOptions): boolean;
|
||||
getGregorianCalendarYearDashMonthDashDay(): TextualYearMonthDay;
|
||||
getGregorianCalendarYearDashMonth(): TextualYearMonth;
|
||||
getWeekDay(): WeekDay;
|
||||
@@ -37,6 +38,7 @@ export interface DateTimeFormatOptions {
|
||||
calendarType: CalendarType;
|
||||
localeData: DateTimeLocaleData;
|
||||
chineseCalendarLocaleData: ChineseCalendarLocaleData;
|
||||
persianCalendarLocaleData: PersianCalendarLocaleData;
|
||||
}
|
||||
|
||||
export interface DateTimeLocaleData {
|
||||
|
||||
Reference in New Issue
Block a user