add explicit type for string-based datetimes, replacing third-party datetime type with internal DateTime type

This commit is contained in:
MaysWind
2025-08-25 00:31:30 +08:00
parent f196ce969b
commit 25681f622d
35 changed files with 423 additions and 404 deletions
+22
View File
@@ -1,5 +1,27 @@
import type { TypeAndName, TypeAndDisplayName } from '@/core/base.ts';
export interface DateTime {
getUnixTime(): number;
getLocalizedCalendarYear(): number;
getGregorianCalendarYear(): number;
getGregorianCalendarQuarter(): number;
getLocalizedCalendarQuarter(): number;
getGregorianCalendarMonth(): number;
getGregorianCalendarMonthName(): string;
getLocalizedCalendarMonth(): number;
getGregorianCalendarDay(): number;
getLocalizedCalendarDay(): number;
getGregorianCalendarYearDashMonthDashDay(): TextualYearMonthDay;
getGregorianCalendarYearDashMonth(): TextualYearMonth;
getWeekDay(): WeekDay;
toGregorianCalendarYearMonthDay(): YearMonthDay;
toGregorianCalendarYear0BasedMonth(): Year0BasedMonth;
format(format: string): string;
}
export type TextualYearMonth = `${number}-${number}`;
export type TextualYearMonthDay = `${number}-${number}-${number}`;
export interface YearQuarter {
readonly year: number;
readonly quarter: number;