Struct LeapYearRule
Serializable rule expressing a calendar's leap-year behavior. Supports a simple "every N years"
interval (e.g., Gregorian's every-4-years base rule) plus the choice of which month receives
the extra day(s) and how many. The Gregorian "century not divisible by 400" exception is
not modeled directly; for Gregorian-accurate leap years, callers can use System.DateTime
via DateUtil instead of a custom calendar.
Assembly: ScyllaCore.dll
Syntax
[Serializable]
public struct LeapYearRule
Properties
Number of extra days added in a leap year.
Declaration
public int ExtraLeapDays { get; }
Property Value
HasLeapYears
Whether the calendar uses leap years at all.
Declaration
public bool HasLeapYears { get; }
Property Value
LeapMonthIndex
Zero-based month index that gains extra days in a leap year.
Declaration
public int LeapMonthIndex { get; }
Property Value
LeapYearInterval
Every Nth year is a leap year.
Declaration
public int LeapYearInterval { get; }
Property Value
Methods
EveryFourYears(int)
Convenience builder: every 4th year, the supplied month gains 1 extra day.
Matches the Gregorian base rule (without the century exception).
Declaration
public static LeapYearRule EveryFourYears(int leapMonthIndex = 1)
Parameters
| Type |
Name |
Description |
| int |
leapMonthIndex |
|
Returns
Returns the number of extra days added to monthIndex for
year. Zero unless the year is a leap year and the supplied
month is the leap month.
Declaration
public int GetExtraDays(int year, int monthIndex)
Parameters
| Type |
Name |
Description |
| int |
year |
|
| int |
monthIndex |
|
Returns
IsLeapYear(int)
Returns true if year is a leap year under this rule.
Negative years apply the same modulo arithmetic so backward-running calendars
continue to align leap years with their forward-running counterparts.
Declaration
public bool IsLeapYear(int year)
Parameters
| Type |
Name |
Description |
| int |
year |
|
Returns
None()
Returns a disabled leap-year rule (the calendar has no leap years).
Declaration
public static LeapYearRule None()
Returns