support calendar display type (Gregorian and Buddhist)

This commit is contained in:
MaysWind
2025-08-28 00:31:59 +08:00
parent c099443783
commit 411130db4e
47 changed files with 769 additions and 788 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
import type { TextualYearMonth, UnixTimeRange } from './datetime.ts';
import type { TextualYearMonth, MonthDay, UnixTimeRange } from './datetime.ts';
export class FiscalYearStart {
public static readonly JanuaryFirstDay = new FiscalYearStart(1, 1);
@@ -79,6 +79,13 @@ export class FiscalYearStart {
return `${this.month.toString().padStart(2, '0')}-${this.day.toString().padStart(2, '0')}` as TextualYearMonth;
}
public toMonthDay(): MonthDay {
return {
month: this.month,
day: this.day
};
}
private static isValidFiscalYearMonthDay(month: number, day: number): boolean {
return 1 <= month && month <= 12 && 1 <= day && day <= FiscalYearStart.MONTH_MAX_DAYS[month - 1];
}