Home Reference Source Repository
import {Year} from 'js-joda/src/Year.js'
public class | source


A year in the ISO-8601 calendar system, such as {@code 2007}.

{@code Year} is an immutable date-time object that represents a year. Any field that can be derived from a year can be obtained.

<b>Note that years in the ISO chronology only align with years in the Gregorian-Julian system for modern years. Parts of Russia did not switch to the modern Gregorian/ISO rules until 1920. As such, historical years must be treated with caution.</b>

This class does not store or represent a month, day, time or time-zone. For example, the value "2007" can be stored in a {@code Year}.

Years represented by this class follow the ISO-8601 standard and use the proleptic numbering system. Year 1 is preceded by year 0, then by year -1.

The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.

Static properties of Class LocalDate

Year.MIN_VALUE = -999.999;

The minimum supported year. Theoretically the minimum could be -28.542.4812 years in javascript. approx LocalDateTime.ofEpochSecond(Number.MIN_SAFE_INTEGER, 0, ZoneOffset.UTC).year()

Year.MAX_VALUE = 999.999;

The maximum supported year. Theoretically the maximum could be 285.428.751 years in javascript. approx LocalDateTime.ofEpochSecond(Number.MAX_SAFE_INTEGER, 0, ZoneOffset.UTC).year()