DateTimeExtensions extension

Extensions on the DateTime class to provide additional functionality.

on

Properties

isMidnight bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks if the current time is exactly midnight (00:00:00.000000).
no setter
yearEnd DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Gets the end date of the year.
no setter
yearStart DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Gets the start date of the year.
no setter

Methods

dayOfMonthOrdinal() String

Available on DateTime, provided by the DateTimeExtensions extension

Returns the ordinal representation of the day of the month.
generateDayList(int days, {bool isStartOfDay = true}) List<DateTime>

Available on DateTime, provided by the DateTimeExtensions extension

Returns a list of DateTime objects for consecutive days.
getNthWeekdayOfMonthInYear(int n, int dayOfWeek) DateTime?

Available on DateTime, provided by the DateTimeExtensions extension

Returns the date of the nth occurrence of dayOfWeek within the current instance's month and year, or null if it does not exist (e.g., 5th Friday in February).
isLeapYear() bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks if the current year is a leap year using DateTimeUtils.isLeapYear.
isUnder13({DateTime? today}) bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date (of birth) is under 13 years old.
nextDay({bool isStartOfDay = true}) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the next day.
prevDay({bool isStartOfDay = true}) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the previous day.
toDateInYear(int setYear) DateTime?

Available on DateTime, provided by the DateTimeExtensions extension

Ignores the year of the current DateTime and returns a new DateTime with the specified setYear.