AppDateUtils class
Date/time helpers built on top of intl.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
Static Methods
-
addDays(
DateTime date, int days) → DateTime -
Adds
daystodateignoring time components. -
currentMonth(
) → DateTimeRange< DateTime> - Returns a DateTimeRange covering the whole current month.
-
currentWeek(
) → DateTimeRange< DateTime> - Returns a DateTimeRange covering the whole current week (Mon–Sun).
-
currentYear(
) → DateTimeRange< DateTime> - Returns a DateTimeRange covering the whole current year.
-
daysInMonth(
int year, int month) → int -
Returns the number of days in
monthofyear. -
endOfDay(
DateTime date) → DateTime -
Returns the end of the day for
date. -
format(
DateTime date, String pattern, {String locale = 'en'}) → String -
Formats
datewith the givenpatternand optionallocale. -
formatDate(
DateTime date, {String locale = 'en'}) → String -
Formats a date as
dd MMM yyyy(e.g.03 Aug 2026). -
formatDateTime(
DateTime date, {String locale = 'en'}) → String -
Formats a date and time as
dd MMM yyyy HH:mm. -
formatDuration(
Duration duration) → String -
Formats a duration as
Xh YmorXm. -
formatRelative(
DateTime date, {String locale = 'en'}) → String -
Formats a date as a relative label (
Today,Yesterday,dd MMM). -
formatTime(
DateTime date, {String locale = 'en'}) → String -
Formats a
DateTimeas a short time label. -
isFuture(
DateTime date) → bool -
Returns whether
dateis in the future (after today, time-ignored). -
isPast(
DateTime date) → bool -
Returns whether
dateis in the past (before today, time-ignored). -
isToday(
DateTime date) → bool -
Returns whether
dateis today. -
startOfDay(
DateTime date) → DateTime -
Returns the start of the day for
date. -
startOfWeek(
DateTime date) → DateTime -
Returns the Monday of the week containing
date. -
tryParse(
String text, String pattern, {String locale = 'en'}) → DateTime? -
Parses
textusingpattern, returningnullon failure.