CalendarSystem
Defines the standard interface for a calendar system. Each calendar system must implement this contract.
Props
The following table outlines the props for the CalendarSystem:
| Name | Type | Default | Description |
|---|---|---|---|
| name | string | - | The unique name of the calendar system (e.g., "gregorian"). |
Methods
The following table outlines the methods for the CalendarSystem:
| Name | Parameters | Returns | Description |
|---|---|---|---|
| addDays | d : Daten : number | Date | Returns a new date that is Params: |
| addMonths | date : Datemonths : number | Date | Returns a new date that is the given number of months from the input date. Params: |
| addYears | date : Dateyears : number | Date | Returns a new date that is the given number of years from the input date. Params: |
| endOfMonth | d : Date | Date | Returns a new date representing the end of the month for the given date. Params: |
| endOfYear | d : Date | Date | Returns a new date representing the end of the year for the given date. Params: |
| getDay | date : Date | number | Gets the day of the month component of the given date. Params: |
| getDaysInMonth | year : numbermonth : number | number | Returns the number of days in the given calendar-system month/year. Params: |
| getDecadeMatrix | baseDate : Dateoptions? : CalendarOptions | Builds a decade view matrix (typically 4x3) for the given base date. Params: | |
| getMonth | date : Date | number | Gets the zero-based calendar month component of the given date. Params: |
| getMonthMatrix | baseDate : Dateoptions? : CalendarOptions | Builds a month view matrix (typically 6x7) for the given base date. Params: | |
| getMonthName | - | string | Returns the localized name for a specific month. |
| getWeekDayNames | locale : stringfirstDayOfWeek : numberweekDaysFormat : string | string[] | Returns localized names for the days of the week in display order, starting from Params: |
| getWeekNumber | date : Date | number | Calculates the week number for a given date based on the calendar's WeekRule and first day of week rules. Params: |
| getYear | date : Date | number | Gets the calendar year component of the given date. Params: |
| getYearMatrix | baseDate : Dateoptions? : CalendarOptions | Builds a year view matrix (typically 4x3) for the given base date. Params: | |
| isSameDate | date1 : Datedate2 : Date | boolean | Determines whether two dates are same. Params: |
| isSameMonth | date1 : Datedate2 : Date | boolean | Determines whether two dates are in the same calendar month and year. Params: |
| isSameYear | date1 : Datedate2 : Date | boolean | Determines whether two Year are same. Params: |
| startOfDecade | d : Date | Date | Returns a new date representing the start of the decade for the given date. Params: |
| startOfMonth | d : Date | Date | Returns a new date representing the start of the month for the given date. Params: |
| startOfYear | d : Date | Date | Returns a new date representing the start of the year for the given date. Params: |
| toDate | year : numbermonth : numberday : numberhour? : numberminute? : numbersecond? : number | Date | Creates a Date object from the given date and time components. Params: |