DateTimeExtensions extension

Extensions on DateTime for formatting, checks, and boundaries.

on

Properties

endOfDay → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

End of day (23:59:59.999).
no setter
endOfMonth → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Last day of the month, end of day.
no setter
endOfWeek → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Sunday of the current week, end of day.
no setter
endOfYear → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

December 31st, end of day (23:59:59.999).
no setter
isLeapYear → bool

Available on DateTime, provided by the DateTimeExtensions extension

Whether the year is a leap year.
no setter
isWeekday → bool

Available on DateTime, provided by the DateTimeExtensions extension

Whether the day is Monday-Friday.
no setter
isWeekend → bool

Available on DateTime, provided by the DateTimeExtensions extension

Whether the day is Saturday or Sunday.
no setter
quarter → int

Available on DateTime, provided by the DateTimeExtensions extension

Quarter of the year (1-4).
no setter
startOfDay → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Start of day (00:00:00.000).
no setter
startOfMonth → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

First day of the month.
no setter
startOfWeek → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Monday of the current week (start of day).
no setter
startOfYear → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

January 1st of the year.
no setter
tomorrow → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Tomorrow at the same time of day.
no setter
yesterday → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Yesterday at the same time of day.
no setter

Methods

ageInYears([DateTime? at]) → int

Available on DateTime, provided by the DateTimeExtensions extension

Whole years between this date and now (or at).
copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) → DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Copy this date with selected fields overridden (local time, preserved by default).
format(String pattern) → String

Available on DateTime, provided by the DateTimeExtensions extension

Formats the date with an intl pattern (e.g. yyyy-MM-dd).
formattedDate(BuildContext context, {String pattern = 'yyyy-MM-dd'}) → String

Available on DateTime, provided by the DateTimeExtensions extension

Formats the date using the locale from context.
isBetween(DateTime start, DateTime end) → bool

Available on DateTime, provided by the DateTimeExtensions extension

Whether this date falls between start and end (inclusive).
isInFuture() → bool

Available on DateTime, provided by the DateTimeExtensions extension

Check if the DateTime is in the future
isInPast() → bool

Available on DateTime, provided by the DateTimeExtensions extension

Check if the DateTime is in the past
isSameDay(DateTime other) → bool

Available on DateTime, provided by the DateTimeExtensions extension

Whether it is the same calendar day as other.
isSameMonth(DateTime other) → bool

Available on DateTime, provided by the DateTimeExtensions extension

Whether it is the same month (and year) as other.
isSameYear(DateTime other) → bool

Available on DateTime, provided by the DateTimeExtensions extension

Whether it is the same year as other.
isToday() → bool

Available on DateTime, provided by the DateTimeExtensions extension

Whether it is the same calendar day as today.
isTomorrow() → bool

Available on DateTime, provided by the DateTimeExtensions extension

Check if the DateTime is tomorrow.
isYesterday() → bool

Available on DateTime, provided by the DateTimeExtensions extension

Check if the DateTime is yesterday
timeAgo(BuildContext context) → String

Available on DateTime, provided by the DateTimeExtensions extension

Relative time description (e.g., "5 minutes ago").