DateTimeExtensions extension

Extension on DateTime to provide additional helper methods and properties.

on

Properties

daysInMonth int

Available on DateTime, provided by the DateTimeExtensions extension

The number of days in the month for this date.
no setter
endOfDay DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns a DateTime object representing the end of the day (23:59:59).
no setter
firstDayOfWeek DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the first day of the current week.
no setter
isDateBeforeOrEqualTodayConcise bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is before or equal to today.
no setter
isLeapYear bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the year is a leap year.
no setter
isToday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is today.
no setter
isTomorrow bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is tomorrow.
no setter
isYesterday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is yesterday.
no setter
lastDayOfWeek DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the last day of the current week.
no setter
startOfDay DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns a DateTime object representing the start of the day (00:00:00).
no setter

Methods

copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second}) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Creates a new DateTime by copying this one and overriding given fields.
format([String pattern = 'yyyy-MM-dd']) String

Available on DateTime, provided by the DateTimeExtensions extension

Formats the date as a string based on the given pattern. Defaults to yyyy-MM-dd.
minutesFrom(DateTime dateTime) int

Available on DateTime, provided by the DateTimeExtensions extension

Returns the difference in minutes from another dateTime.
secondsFrom(DateTime dateTime) int

Available on DateTime, provided by the DateTimeExtensions extension

Returns the difference in seconds from another dateTime.
timeAgo() String

Available on DateTime, provided by the DateTimeExtensions extension

Returns a human-readable string representing how long ago this date was.