Year

The built-in type Year represents years.

toInt : Year -> Int

Maps a year to its representation as an integer.

Examples

val a = Year::toInt (Year::fromInt 2021)
//    = 2021

fromInt : Int -> Year

Constructs a year from its integer representation. Valid range is -999999999 to 999999999. Year numbers outside this range results in an error.

isLeapYear : Year -> Boolean

Checks whether a year is a leap year.

Examples

val leap2000 = Year::isLeapYear (Year::fromInt 2000)
//           = True
val leap2013 = Year::isLeapYear (Year::fromInt 2013)
//           = False

length : Year -> Int

Returns the number of days in the given year.

Examples

val days2000 = Year::length (Year::fromInt 2000)
//           = 366
val days2013 = Year::length (Year::fromInt 2013)
//           = 365