DateTimeTimeExtension extension

on

Properties

date DateTime
Returns only year, month and day
no setter
daysInMonth int
Returns the amount of days that are in this month.
no setter
firstDayOfMonth DateTime
Returns the first day of this month
no setter
firstDayOfWeek DateTime
Returns the Monday of this week
no setter
firstDayOfYear DateTime
Returns the first day of this year
no setter
isLeapYear bool
Returns true if this year is a leap year.
no setter
isToday bool
Returns if today, true
no setter
isTomorrow bool
Returns if tomorrow, true
no setter
isWeekend bool
no setter
isWorkday bool
no setter
lastDayOfMonth DateTime
Returns the last day of this month (considers leap years)
no setter
lastDayOfWeek DateTime
Returns the Sunday of this week
no setter
lastDayOfYear DateTime
Returns the last day of this year
no setter
timeOfDay Duration
Returns only the time
no setter
wasYesterday bool
Returns if yesterday, true
no setter

Methods

clamp({DateTime? min, DateTime? max}) DateTime
Returns this DateTime clamped to be in the range min-max.
copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) DateTime
isAtSameDayAs(DateTime other) bool
Returns true if other is on the same day as this.
isAtSameHourAs(DateTime other) bool
Returns true if other is at the same hour as this.
isAtSameMicrosecondAs(DateTime other) bool
Returns true if other is at the same microsecond as this.
isAtSameMillisecondAs(DateTime other) bool
Returns true if other is at the same millisecond as this.
isAtSameMinuteAs(DateTime other) bool
Returns true if other is at the same minute as this.
isAtSameMonthAs(DateTime other) bool
Returns true if other is in the same month as this.
isAtSameSecondAs(DateTime other) bool
Returns true if other is at the same second as this.
isAtSameYearAs(DateTime other) bool
Returns true if other is in the same year as this.
shift({int years = 0, int months = 0, int days = 0, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0}) DateTime
Adds time units to the calendar date and/or clock time.
to(DateTime to, {Duration by = const Duration(days: 1)}) Iterable<DateTime>
Returns a range of dates to to, exclusive start, inclusive end

Operators

operator +(Duration duration) DateTime
Adds this DateTime and Duration and returns the sum as a new DateTime object.
operator -(Duration duration) DateTime
Subtracts the Duration from this DateTime returns the difference as a new DateTime object.