LocalDate class
A date with no timezone.
- Implemented types
- Annotations
-
- @immutable
Constructors
- LocalDate([int year = 0, int month = 1, int day = 1])
- Constructs a LocalDate from individual parts.
- LocalDate.fromDateTime(DateTime dateTime)
-
Constructs a LocalDate from a standard Dart DateTime.
The timezone (if any) of
dateTime
is ignored. - LocalDate.now()
- Constructs a LocalDate with the current date and time in the current time zone.
- LocalDate.parse(String date)
-
Parses an ISO 8601 date string.
factory
Properties
- day → int
-
The day starting at 1.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isLeapYear → bool
-
True if this date falls in a leap year.
no setter
- month → int
-
The month from 1 to 12.
final
- ordinalDay → int
-
The number of days since the beginning of the year. This will range from
1 to 366.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- weekday → Weekday
-
The day of the week.
no setteroverride
- year → int
-
The year.
final
Methods
-
compareTo(
LocalDate other) → int -
Compares this object to another object.
override
-
minusPeriod(
Period p) → LocalDate - Subtracts Period of time.
-
minusTimespan(
Timespan t) → LocalDate - Subtracts a Timespan.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
periodUntil(
HasDate other) → Period - Finds the Period between this date and another.
-
plusPeriod(
Period p) → LocalDate - Adds Period of time.
-
plusTimespan(
Timespan t) → LocalDate - Adds a Timespan.
-
replace(
{int? year, int? month, int? day}) → LocalDate - Returns a new date with one or more fields replaced. Uses the largest valid day if the resulting month is shorter.
-
timespanUntil(
LocalDate other) → Timespan - Returns the Timespan between this and another date. The result will always be an integer number of days.
-
toDateTime(
) → DateTime -
Converts this to a DateTime in the local time zone.
override
-
toString(
) → String -
Returns the date in ISO 8601 format.
override
Operators
-
operator <(
LocalDate other) → bool - Less than operator.
-
operator <=(
LocalDate other) → bool - Less than or equals operator.
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator >(
LocalDate other) → bool - Greater than operator.
-
operator >=(
LocalDate other) → bool - Greater than or equals operator.