Year¶
common
value class Year(value: Int) : Comparable<Year>
A year as defined by ISO-8601.
Parameters¶
common
value | the year |
Throws¶
io.islandtime.DateTimeException | if the year is invalid |
Constructors¶
Year | common fun Year(value: Long) Creates a Year. |
Year | common fun Year(value: Int) Creates a Year. |
Types¶
Name | Summary |
---|---|
Companion | common object Companion |
Functions¶
Name | Summary |
---|---|
compareTo | common open operator override fun compareTo(other: Year): Int |
contains | common operator fun contains(date: Date): Boolean Checks if this year contains the specified date. common operator fun contains(yearMonth: YearMonth): Boolean Checks if this year contains the specified year-month. |
minus | common operator fun minus(centuries: Centuries): Year Returns this year with centuries subtracted from it. common operator fun minus(decades: Decades): Year Returns this year with decades subtracted from it. common operator fun minus(years: Years): Year Returns this year with years subtracted from it. |
plus | common operator fun plus(centuries: Centuries): Year Returns this year with centuries added to it. common operator fun plus(decades: Decades): Year Returns this year with decades added to it. common operator fun plus(years: Years): Year Returns this year with years added to it. |
toString | common open override fun toString(): String Converts this year to a string in ISO-8601 extended format. For example, 2012 , -0001 , or +10000 . |
Properties¶
Name | Summary |
---|---|
dateRange | common val dateRange: DateRange The date range of the year. |
dayRange | 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 | common val endDate: Date The last date of the year. |
isLeap | common val isLeap: Boolean Checks if this is a leap year. |
lastDay | 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 | common val length: Days The length of the year in days. |
startDate | common val startDate: Date The first date of the year. |
value | common val value: Int The year value. |
Extensions¶
Name | Summary |
---|---|
at | common infix fun Year.at(month: Month): YearMonth Combines a year and month to create a YearMonth. |
atMonth | common fun Year.atMonth(number: Int): YearMonth Combines a year and month number to create a YearMonth. |
toJavaYear | jvm fun Year.toJavaYear(): Year Converts this year to an equivalent Java Year . |
toNSDateComponents | darwin fun Year.toNSDateComponents(includeCalendar: Boolean = false): <ERROR CLASS> Converts this year to an equivalent NSDateComponents object. |