Companion

object Companion

Properties

Link copied to clipboard
const val DAYS_COMMON: Int = 365

Number of days in a normal year.

Link copied to clipboard
const val DAYS_LEAP: Int = 366

Number of days in a leap year.

Functions

Link copied to clipboard
fun checked(year: Int): Int

Creates a Year instance checking that the year is between 1 and 9999 inclusive.

Link copied to clipboard
fun days(isLeap: Boolean): Int

Get the number of days of a year depending on being leap or not. Normal, non leap years contain 365 days, while leap ones 366.

Link copied to clipboard
fun daysSinceOne(year: Int): Int

Number of days since 1 and the beginning of the specified year.

Link copied to clipboard
fun fromDays(days: Int): Year

Computes the year from the number of days since 0001-01-01.

Link copied to clipboard
fun isLeap(year: Int): Boolean

Determines if a year is leap. The model works for years between 1..9999. Outside this range, the result might be invalid.

Link copied to clipboard

Determines if a year is leap checking that the year is between 1..9999 or throwing a DateException when outside that range.

Link copied to clipboard

Return the number of leap years that happened between 1 and the specified year.