LocalDate class final

A Gregorian calendar date, without a time or timezone. Year 0 is 1 BC; negative years use astronomical numbering.

Implemented types

Constructors

LocalDate(int year, int month, int day)
Creates a valid Gregorian date or throws RangeError.
factory
LocalDate.fromJulianDay(int value)
Converts a supported Julian day ordinal to its Gregorian date.
factory
LocalDate.parse(String text)
Parses YYYY-MM-DD, optionally followed by BC.
factory

Properties

day → int
Day of the month, validated against the month and leap-year rules.
final
hashCode → int
The hash code for this object.
no setteroverride
julianDay → int
Integer calendar-day ordinal used for exact comparison and date arithmetic.
final
month → int
Gregorian month in the range 1 through 12.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
year → int
Astronomical year; year zero corresponds to 1 BC.
final

Methods

addDays(int days) → LocalDate
Adds whole calendar days, rejecting results outside the supported range.
compareTo(LocalDate other) → int
Compares this object to another object.
override
daysUntil(LocalDate other) → int
Signed number of calendar days from this date to other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

tryParse(String text) → LocalDate?
Returns null when text is invalid or outside the supported range.

Constants

maxJulianDay → const int
Last supported Julian day for a finite calendar date.
minJulianDay → const int
First supported Julian day, matching the finite PostgreSQL DATE range.