core / io.islandtime / Year

Year

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) inline class Year : Comparable<Year>

A year as defined by ISO-8601.

Constructors

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

<init>

Creates a Year.

<init>(value: Int)

Properties

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

dateRange

The date range of the year.

val dateRange: DateRange
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

dayRange

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
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

endDate

The last date of the year.

val endDate: Date
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

isLeap

Checks if this is a leap year.

val isLeap: Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

isValid

Checks if this year is within the supported range.

val isValid: Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

lastDay

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
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

length

The length of the year in days.

val length: IntDays
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

startDate

The first date of the year.

val startDate: Date
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

value

The year value.

val value: Int

Functions

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

compareTo

fun compareTo(other: Year): Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

contains

operator fun contains(yearMonth: YearMonth): Boolean
operator fun contains(date: Date): Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

minus

operator fun minus(years: LongYears): Year
operator fun minus(years: IntYears): Year
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

plus

operator fun plus(years: LongYears): Year
operator fun plus(years: IntYears): Year
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

toString

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

fun toString(): String
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

validated

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

fun validated(): Year

Companion Object Properties

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MAX

The latest supported Year, which can be used as a "far future" sentinel.

val MAX: Year
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MAX_VALUE

The latest supported year value.

const val MAX_VALUE: Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MIN

The earliest supported Year, which can be used as a "far past" sentinel.

val MIN: Year
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MIN_VALUE

The earliest supported year value.

const val MIN_VALUE: Int

Extension Functions

(jvm)

toJavaYear

Convert to an equivalent Java Year.

fun Year.toJavaYear(): Year