Year

A year as defined by ISO-8601.

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

Parameters

value

the year

Constructors

Year
Link copied to clipboard
common

Creates a Year.

fun Year(value: Int)

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(yearMonth: YearMonth): Boolean
operator fun contains(date: Date): Boolean
equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
minus
Link copied to clipboard
common
operator fun minus(years: LongYears): Year
operator fun minus(years: IntYears): Year
plus
Link copied to clipboard
common
operator fun plus(years: LongYears): Year
operator fun plus(years: IntYears): Year
toString
Link copied to clipboard
common

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

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

Ensures that this year is valid, throwing an exception if it isn't.

fun validated(): Year

Properties

dateRange
Link copied to clipboard
common

The date range of the year.

val dateRange: DateRange
dayRange
Link copied to clipboard
common

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.

val dayRange: IntRange
endDate
Link copied to clipboard
common

The last date of the year.

val endDate: Date
isLeap
Link copied to clipboard
common

Checks if this is a leap year.

val isLeap: Boolean
isValid
Link copied to clipboard
common

Checks if this year is within the supported range.

val isValid: Boolean
lastDay
Link copied to clipboard
common

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

val lastDay: Int
length
Link copied to clipboard
common

The length of the year in days.

val length: IntDays
startDate
Link copied to clipboard
common

The first date of the year.

val startDate: Date
value
Link copied to clipboard
common

The year value.

val value: Int

Extensions

at
Link copied to clipboard
common

Combines a year and month to create a YearMonth.

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

Combines a year and month number to create a YearMonth.

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

Converts this year to an equivalent Java Year.

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

Converts this year to an equivalent NSDateComponents object.

fun Year.toNSDateComponents(includeCalendar: Boolean): <ERROR CLASS>