DateTimeComparisonExtensions extension

Extensions on DateTime for comparison, range, and equality checks.

on

Methods

isAfterNow([DateTime? now]) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Checks if the date is in the future compared to the current date and time.
isAfterNullable(DateTime? other) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns false if other is null, otherwise returns the result of comparing this DateTime with other using the isAfter method. Audited: 2026-06-12 11:26 EDT
isAnnualDateInRange(DateTimeRange<DateTime>? range, {bool isInclusive = true}) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns true if this DateTime is within the specified range.
isBeforeNow([DateTime? now]) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Checks if the date is in the past compared to the current date and time.
isBeforeNullable(DateTime? other) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns false if other is null, otherwise returns the result of comparing this DateTime with other using the isBefore method. Audited: 2026-06-12 11:26 EDT
isBetween(DateTime start, DateTime end, {bool isInclusive = true}) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns true if this DateTime is between start and end.
isBetweenRange(DateTimeRange<DateTime>? range, {bool isInclusive = true}) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns true if this DateTime is within the specified range, false if range is null.
isDateAfterToday({DateTime? now}) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns true if this date is strictly after today (i.e., tomorrow or later).
isSameDateOnly(DateTime other) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Checks if the current DateTime has the same date (year, month, day) as another DateTime.
isSameDateOrAfter(DateTime other) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns true if this date (date-only) is the same as or after other.
isSameDateOrBefore(DateTime other) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns true if this date (date-only) is the same as or before other.
isSameDayMonth(DateTime other) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Checks if the current DateTime has the same day and month as another DateTime.
isSameMonth(DateTime other) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Checks if the current DateTime has the same month as another DateTime.
isToday({DateTime? now, bool ignoreYear = false}) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Returns true if this DateTime matches the current date (today).
isYearCurrent({DateTime? now}) → bool

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Checks if the date is in the current calendar year.
toDateOnly() → DateTime

Available on DateTime, provided by the DateTimeComparisonExtensions extension

Removes the time component from the DateTime object, returning only the date part (year, month, and day). Audited: 2026-06-12 11:26 EDT