Year

value class Year(value: Int) : Comparable<Year>

A year as defined by ISO-8601.

Parameters

value

the year

Throws

if the year is invalid

Constructors

Year
Link copied to clipboard
common
fun Year(value: Long)

Creates a Year.

Year
Link copied to clipboard
common
fun Year(value: Int)

Creates a Year.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

compareTo
Link copied to clipboard
common
open operator override fun compareTo(other: Year): Int
contains
Link copied to clipboard
common
operator fun contains(date: Date): Boolean

Checks if this year contains the specified date.

operator fun contains(yearMonth: YearMonth): Boolean

Checks if this year contains the specified year-month.

minus
Link copied to clipboard
common
operator fun minus(centuries: Centuries): Year

Returns this year with centuries subtracted from it.

operator fun minus(decades: Decades): Year

Returns this year with decades subtracted from it.

operator fun minus(years: Years): Year

Returns this year with years subtracted from it.

plus
Link copied to clipboard
common
operator fun plus(centuries: Centuries): Year

Returns this year with centuries added to it.

operator fun plus(decades: Decades): Year

Returns this year with decades added to it.

operator fun plus(years: Years): Year

Returns this year with years added to it.

toString
Link copied to clipboard
common
open override fun toString(): String

Converts this year to a string in ISO-8601 extended format. For example, 2012, -0001, or +10000.

Properties

dateRange
Link copied to clipboard
common
val dateRange: DateRange

The date range of the year.

dayRange
Link copied to clipboard
common
val dayRange: IntRange

The day range of the year. This will be either 1..365 or 1.366 depending on whether this is a common or leap year.

endDate
Link copied to clipboard
common
val endDate: Date

The last date of the year.

isLeap
Link copied to clipboard
common
val isLeap: Boolean

Checks if this is a leap year.

lastDay
Link copied to clipboard
common
val lastDay: Int

The last day of the year. This will be either 365 or 366 depending on whether this is a common or leap year.

length
Link copied to clipboard
common
val length: Days

The length of the year in days.

startDate
Link copied to clipboard
common
val startDate: Date

The first date of the year.

value
Link copied to clipboard
common
val value: Int

The year value.

Extensions

at
Link copied to clipboard
common
infix fun Year.at(month: Month): YearMonth

Combines a year and month to create a YearMonth.

atMonth
Link copied to clipboard
common
fun Year.atMonth(number: Int): YearMonth

Combines a year and month number to create a YearMonth.

toJavaYear
Link copied to clipboard
fun Year.toJavaYear(): Year

Converts this year to an equivalent Java Year.

toNSDateComponents
Link copied to clipboard
darwin
fun Year.toNSDateComponents(includeCalendar: Boolean = false): <ERROR CLASS>

Converts this year to an equivalent NSDateComponents object.