SimpleRelativeDay enum
Human-relative calendar-day buckets produced by getSimpleRelativeDay.
Each value names one calendar-day relationship between a date and a
reference now, measured in whole calendar days (time-of-day dropped).
The classifier covers BOTH past and future at single-day resolution and
returns null (no enum value) when the date is more than ~2 months away,
so callers get a typed label only when one is actually useful.
Only the values listed here are ever returned. There are deliberately no
ThisWeek / ThisMonth / coarse-week members: the spec's source carried
four such values that the classifier never emitted, and silently shipping
unreachable enum cases would mislead switch authors into writing dead
arms. They were dropped at inclusion time — see the package notes.
Example:
final DateTime now = DateTime(2024, 12, 29);
DateTime(2024, 12, 29).getSimpleRelativeDay(now: now); // Today
DateTime(2024, 12, 30).getSimpleRelativeDay(now: now); // Tomorrow
DateTime(2025, 1, 1).getSimpleRelativeDay(now: now); // NextWeekday
DateTime(2025, 6, 15).getSimpleRelativeDay(now: now); // null (too far)
Values
- today → const SimpleRelativeDay
-
The date is the same calendar day as
now. - yesterday → const SimpleRelativeDay
-
The date is exactly one calendar day before
now. - tomorrow → const SimpleRelativeDay
-
The date is exactly one calendar day after
now. - beforeYesterday → const SimpleRelativeDay
-
The date is exactly two calendar days before
now(the day before yesterday). - afterTomorrow → const SimpleRelativeDay
-
The date is exactly two calendar days after
now(the day after tomorrow). - lastWeekday → const SimpleRelativeDay
-
The date is a named weekday in the past, 3–13 calendar days before
now(e.g. "Last Tuesday"). Pair with RelativeDayResult.weekdayName. - nextWeekday → const SimpleRelativeDay
-
The date is a named weekday in the future, 3–13 calendar days after
now(e.g. "Next Tuesday"). Pair with RelativeDayResult.weekdayName. - lastMonth → const SimpleRelativeDay
-
The date falls in the previous calendar month relative to
now. - nextMonth → const SimpleRelativeDay
-
The date falls in the next calendar month relative to
now.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
SimpleRelativeDay> - A constant List of the values in this enum, in order of their declaration.