DateTimeBasics extension

Utility extension methods for the core DateTime class.

on

Methods

addCalendarDays(int numberOfDays) DateTime
Adds a specified number of days to this DateTime.
calendarDaysTill(int year, int month, int day) int
Returns the number of calendar days till the specified date.
copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) DateTime
Copies a DateTime, overriding specified values.
isAtOrAfter(DateTime other) bool
Returns true if this occurs at or after other, accounting for time zones.
isAtOrBefore(DateTime other) bool
Returns true if this occurs at or before other, accounting for time zones.

Operators

operator +(Duration duration) DateTime
Returns a new DateTime instance with duration added to this.
operator -(DateTime other) Duration
Returns the Duration between this and other.
operator <(DateTime other) bool
Returns true if this occurs strictly before other, accounting for time zones.
operator <=(DateTime other) bool
Returns true if this occurs at or before other, accounting for time zones.
operator >(DateTime other) bool
Returns true if this occurs strictly after other, accounting for time zones.
operator >=(DateTime other) bool
Returns true if this occurs at or after other, accounting for time zones.