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 days to date ignoring 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 month of year.
endOfDay(DateTime date) → DateTime
Returns the end of the day for date.
format(DateTime date, String pattern, {String locale = 'en'}) → String
Formats date with the given pattern and optional locale.
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 Ym or Xm.
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 DateTime as a short time label.
isFuture(DateTime date) → bool
Returns whether date is in the future (after today, time-ignored).
isPast(DateTime date) → bool
Returns whether date is in the past (before today, time-ignored).
isToday(DateTime date) → bool
Returns whether date is 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 text using pattern, returning null on failure.