Moment class

A subclass of DateTime. Therefore:

Moment.now() is DateTime == true // always

Set a global localization:

Global localizations will affect all moment instances, except those with explicitly set localizations.

Moment.setGlobalLocalization(MomentLocalizations.fr());

An instance with explicit localization:

Moment.now(localization: MomentLocalizations.mn())

Formatting

Moment().format will format DateTime based on the payload. For example:

Moment.fromMillisecondsSinceEpoch(0, isUtc: true).LLLL; // Thursday, January 1 1970 00:00 AM

See FormatterTokens

Inheritance
Available extensions

Constructors

Moment(DateTime dateTime, {MomentLocalization? localization})
A Moment created using given dateTime;
Moment.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch, {bool isUtc = false, MomentLocalization? localization})
Moment.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch, {bool isUtc = false, MomentLocalization? localization})
Moment.now({MomentLocalization? localization})
A Moment created using DateTime.now(), in Local timezone
Moment.nowWithTimezone(bool isUtc, {MomentLocalization? localization})
factory

Properties

date Moment

Available on Moment, provided by the MomentBenefitsPlus extension

no setter
date DateTime

Available on DateTime, provided by the MomentBenefits extension

Returns new DateTime with the date at 00:00:00 AM, preserves timezone
no setter
day int
The day of the month [1..31].
no setterinherited
dayOfYear int

Available on DateTime, provided by the MomentBenefits extension

Returns ordinal day of the year in the current timezone
no setter
forcedSuperType DateTime

Available on Moment, provided by the MomentBenefitsPlus extension

Returns this as DateTime (the super type)
no setter
hasExplicitLocalization bool
no setter
hashCode int
The hash code for this object.
no setterinherited
hour int
The hour of the day, expressed as in a 24-hour clock [0..23].
no setterinherited
hour12 int

Available on DateTime, provided by the MomentBenefits extension

Returns hour in 12-hour format
no setter
isAm bool

Available on DateTime, provided by the MomentBenefits extension

Returns whether the hour is before noon (ante meridiem) in the current timezone
no setter
isFuture bool

Available on DateTime, provided by the MomentBenefits extension

no setter
isLeapYear bool

Available on DateTime, provided by the MomentBenefits extension

Returns if year is leap year.
no setter
isMidnight bool

Available on DateTime, provided by the MomentBenefits extension

Whether it rquals date
no setter
isPast bool

Available on DateTime, provided by the MomentBenefits extension

no setter
isPm bool

Available on DateTime, provided by the MomentBenefits extension

Returns whether the hour is after noon (post meridiem) in the current timezone
no setter
isUtc bool
True if this DateTime is set to UTC time.
finalinherited
LL String
no setter
ll String
no setter
lll String
no setter
LLL String
no setter
llll String
no setter
LLLL String
no setter
localization MomentLocalization
Returns localization of this instance. If this doesn't have localization, returns the global localization.
no setter
LT String
no setter
LTS String
no setter
microsecond int
The microsecond [0...999].
no setterinherited
microsecondsSinceEpoch int
The number of microseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setterinherited
millisecond int
The millisecond [0...999].
no setterinherited
millisecondsSinceEpoch int
The number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setterinherited
minute int
The minute [0...59].
no setterinherited
month int
The month [1..12].
no setterinherited
quarter int

Available on DateTime, provided by the MomentBenefits extension

Returns quarter of the year.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
The second [0...59].
no setterinherited
setLocalization MomentLocalization?
Original localization of this instance
no setter
timeZoneName String
The time zone name.
no setterinherited
timeZoneOffset Duration
The time zone offset, which is the difference between local time and UTC.
no setterinherited
week int

Available on DateTime, provided by the MomentBenefits extension

Returns ISO week number of the year
no setter
weekday int
The day of the week monday..sunday.
no setterinherited
weekYear int

Available on DateTime, provided by the MomentBenefits extension

Returns year according to ISO week number of the year
no setter
year int
The year.
no setterinherited

Methods

add(Duration duration) Moment
Returns new Moment with added duration
override
calendar({DateTime? reference, bool omitHours = false, String? customFormat}) String
Returns calendar string in accordance with the reference, such as Yesterday, Last Sunday, or default date format concatenated with default hour format. Default formats are derived from the current localization.
clone() Moment

Available on Moment, provided by the MomentBenefitsPlus extension

clone() DateTime

Available on DateTime, provided by the MomentBenefits extension

Returns new DateTime, preserves timezone
compareTo(DateTime other) int
Compares this DateTime object to other, returning zero if the values are equal.
inherited
copyWith({DateTime? dateTime, MomentLocalization? localization}) Moment
Returns new Moment with new values
copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond, bool? isUtc}) DateTime

Available on DateTime, provided by the DateTimeCopyWith extension

Creates a new DateTime from this one by updating individual properties.
difference(DateTime other) Duration
Returns a Duration with the difference when subtracting other from this DateTime.
inherited
differenceInDays(DateTime other) int

Available on DateTime, provided by the MomentBenefits extension

Difference calculated after omitting hour, minute, ..., microsecond
endOf(DurationUnit unit) Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returned object will have same timezone as this
endOf(DurationUnit unit) DateTime

Available on DateTime, provided by the EndOfUnit extension

Returned object will have same timezone as this
endOfDay() DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns end of the day
endOfDay() Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns end of the day
endOfHour() DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns end of the hour
endOfHour() Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns end of the hour
endOfIsoWeek() DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns end of the ISO week (always Sunday)
endOfIsoWeek() Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns start of the ISO week (always Monday)
endOfLastDay() Moment

Available on Moment, provided by the DayFinderMoment extension

Returns a new Moment of same timezone
endOfLastDay() DateTime

Available on DateTime, provided by the DayFinder extension

Returns a new DateTime of same timezone
endOfLastHour() Moment

Available on Moment, provided by the HourFinderMoment extension

Returns a new Moment of same timezone
endOfLastHour() DateTime

Available on DateTime, provided by the HourFinder extension

Returns a new DateTime of same timezone
endOfLastIsoWeek() Moment

Available on Moment, provided by the IsoWeekFinderMoment extension

Assumes this is in local timezone, but will preserve the timezone
endOfLastIsoWeek() DateTime

Available on DateTime, provided by the IsoWeekFinder extension

Assumes this is in local timezone, but will preserve the timezone
endOfLastLocalWeek([int? weekStart]) DateTime

Available on DateTime, provided by the LocalWeekFinder extension

Assumes this is in local timezone, but will preserve the timezone
endOfLastLocalWeek([int? weekStart]) Moment

Available on Moment, provided by the LocalWeekFinderMoment extension

Assumes this is in local timezone, but will preserve the timezone
endOfLastMinute() DateTime

Available on DateTime, provided by the MinuteFinder extension

Returns a new DateTime of same timezone
endOfLastMinute() Moment

Available on Moment, provided by the MinuteFinderMoment extension

Returns a new Moment of same timezone
endOfLastMonth() Moment

Available on Moment, provided by the MonthFinderMoment extension

Returns a new Moment of same timezone
endOfLastMonth() DateTime

Available on DateTime, provided by the MonthFinder extension

Returns a new DateTime of same timezone
endOfLastYear() Moment

Available on Moment, provided by the YearFinderMoment extension

Returns a new Moment of same timezone
endOfLastYear() DateTime

Available on DateTime, provided by the YearFinder extension

Returns a new DateTime of same timezone
endOfLocalWeek([int? weekStart]) Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns end of the week based on localization.weekStart. You can override this with weekStart
endOfLocalWeek([int? weekStart]) DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns start of the week based on weekStart. If it's null, it uses Moment.defaultLocalization.weekStart
endOfMillisecond() Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns end of the millisecond
endOfMillisecond() DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns end of the millisecond
endOfMinute() DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns end of the minute
endOfMinute() Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns end of the minute
endOfMonth() Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns end of the month
endOfMonth() DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns end of the month
endOfNextDay() Moment

Available on Moment, provided by the DayFinderMoment extension

Returns a new Moment of same timezone
endOfNextDay() DateTime

Available on DateTime, provided by the DayFinder extension

Returns a new DateTime of same timezone
endOfNextHour() DateTime

Available on DateTime, provided by the HourFinder extension

Returns a new DateTime of same timezone
endOfNextHour() Moment

Available on Moment, provided by the HourFinderMoment extension

Returns a new Moment of same timezone
endOfNextIsoWeek() DateTime

Available on DateTime, provided by the IsoWeekFinder extension

Assumes this is in local timezone, but will preserve the timezone
endOfNextIsoWeek() Moment

Available on Moment, provided by the IsoWeekFinderMoment extension

Assumes this is in local timezone, but will preserve the timezone
endOfNextLocalWeek([int? weekStart]) DateTime

Available on DateTime, provided by the LocalWeekFinder extension

Assumes this is in local timezone, but will preserve the timezone
endOfNextLocalWeek([int? weekStart]) Moment

Available on Moment, provided by the LocalWeekFinderMoment extension

Assumes this is in local timezone, but will preserve the timezone
endOfNextMinute() DateTime

Available on DateTime, provided by the MinuteFinder extension

Returns a new DateTime of same timezone
endOfNextMinute() Moment

Available on Moment, provided by the MinuteFinderMoment extension

Returns a new Moment of same timezone
endOfNextMonth() DateTime

Available on DateTime, provided by the MonthFinder extension

Returns a new DateTime of same timezone
endOfNextMonth() Moment

Available on Moment, provided by the MonthFinderMoment extension

Returns a new Moment of same timezone
endOfNextYear() Moment

Available on Moment, provided by the YearFinderMoment extension

Returns a new Moment of same timezone
endOfNextYear() DateTime

Available on DateTime, provided by the YearFinder extension

Returns a new DateTime of same timezone
endOfSecond() Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns end of the second
endOfSecond() DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns end of the second
endOfYear() DateTime

Available on DateTime, provided by the EndOfUnit extension

Returns end of the year
endOfYear() Moment

Available on Moment, provided by the EndOfUnitMoment extension

Returns end of the year
format([String payload = MomentLocalization.localizationDefaultDateFormat, bool forceLocal = false]) String
Formats date according to payload. See also: FormatterToken
format({String payload = MomentLocalization.localizationDefaultDateFormat, bool forceLocal = false, MomentLocalization? localization}) String

Available on DateTime, provided by the MomentBenefits extension

formatDate([bool forceLocal = false]) String
Localization Default formatters
formatDateShort([bool forceLocal = false]) String
formatDateTime([bool forceLocal = false]) String
formatDateTimeShort([bool forceLocal = false]) String
formatDateTimeWithWeekday([bool forceLocal = false]) String
formatDateTimeWithWeekdayShort([bool forceLocal = false]) String
formatTime([bool forceLocal = false]) String
formatTimeWithSeconds([bool forceLocal = false]) String
from(DateTime anchor, {bool dropPrefixOrSuffix = false, Abbreviation form = Abbreviation.none}) String
This will not return precise duration. See MomentLocalization.relativeThreshold for details
fromNow({bool dropPrefixOrSuffix = false, Abbreviation form = Abbreviation.none}) String
Example when using LocalizationEnUs:
fromNowPrecise({bool round = true, bool omitZeros = true, bool includeWeeks = true, Abbreviation form = Abbreviation.none, String? delimiter, DurationFormat format = DurationFormat.auto, bool dropPrefixOrSuffix = false}) String
Example when using LocalizationEnUs:
fromPrecise(DateTime anchor, {bool round = true, bool omitZeros = true, bool includeWeeks = true, Abbreviation form = Abbreviation.none, String? delimiter, DurationFormat format = DurationFormat.auto, bool dropPrefixOrSuffix = false}) String
This will return precise durations. For imprecise durations, use from()
isAfter(DateTime other) bool
Whether this DateTime occurs after other.
inherited
isAtSameDayAs(DateTime other, {bool enforceUTC = false}) bool

Available on DateTime, provided by the UnitComparision extension

Returns if two dates are in same day, month, year.
isAtSameHourAs(DateTime other, {bool enforceUTC = false}) bool

Available on DateTime, provided by the UnitComparision extension

Returns if two dates are in same hour, day, month, year.
isAtSameMicrosecondAs(DateTime other, {bool enforceUTC = false}) bool

Available on DateTime, provided by the UnitComparision extension

Returns if two dates are in same microsecond, millisecond, second, minute, hour, day, month, year.
isAtSameMillisecondAs(DateTime other, {bool enforceUTC = false}) bool

Available on DateTime, provided by the UnitComparision extension

Returns if two dates are in same millisecond, second, minute, hour, day, month, year.
isAtSameMinuteAs(DateTime other, {bool enforceUTC = false}) bool

Available on DateTime, provided by the UnitComparision extension

Returns if two dates are in same minute, hour, day, month, year.
isAtSameMomentAs(DateTime other) bool
Whether this DateTime occurs at the same moment as other.
inherited
isAtSameMonthAs(DateTime other, {bool enforceUTC = false}) bool

Available on DateTime, provided by the UnitComparision extension

Returns if two dates are in same month, year.
isAtSameSecondAs(DateTime other, {bool enforceUTC = false}) bool

Available on DateTime, provided by the UnitComparision extension

Returns if two dates are in same second, minute, hour, day, month, year.
isAtSameYearAs(DateTime other, {bool enforceUTC = false}) bool

Available on DateTime, provided by the UnitComparision extension

Returns if two dates are in same year.
isBefore(DateTime other) bool
Whether this DateTime occurs before other.
inherited
isFutureAnchored([DateTime? anchor]) bool

Available on DateTime, provided by the MomentBenefits extension

isPastAnchored([DateTime? anchor]) bool

Available on DateTime, provided by the MomentBenefits extension

isSameLocalWeekAs(DateTime other) bool

Available on Moment, provided by the UnitComparisonMoment extension

Returns whether this and other is in same local week. Local week is determined by localization.weekStart, defaults to DateTime.monday
isSameLocalWeekAs(DateTime other, [int? weekStart]) bool

Available on DateTime, provided by the UnitComparision extension

Returns whether this and other is in same local week. Local week is determined by weekStart, defaults to DateTime.monday
lastFriday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Friday in the past
lastFriday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Friday in the past
lastMonday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Monday in the past
lastMonday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Monday in the past
lastSaturday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Saturday in the past
lastSaturday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Saturday in the past
lastSunday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Sunday in the past
lastSunday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Sunday in the past
lastThursday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Thursday in the past
lastThursday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Thursday in the past
lastTuesday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Tuesday in the past
lastTuesday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Tuesday in the past
lastWednesday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Wednesday in the past
lastWednesday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Wednesday in the past
lastWeekday(int weekday) DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of last nth weekday
lastWeekday(int weekday) Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of last nth weekday
nextFriday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Friday in the Future
nextFriday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Friday in the Future
nextMonday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Monday in the Future
nextMonday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Monday in the Future
nextSaturday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Saturday in the Future
nextSaturday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Saturday in the Future
nextSunday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Sunday in the Future
nextSunday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Sunday in the Future
nextThursday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Thursday in the Future
nextThursday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Thursday in the Future
nextTuesday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Tuesday in the Future
nextTuesday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Tuesday in the Future
nextWednesday() Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest Wednesday in the Future
nextWednesday() DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest Wednesday in the Future
nextWeekday(int weekday) Moment

Available on Moment, provided by the WeekdayFinderMoment extension

Returns new Moment instance of nearest nth weekday in the future
nextWeekday(int weekday) DateTime

Available on DateTime, provided by the WeekdayFinder extension

Returns new DateTime instance of nearest nth weekday in the future
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rangeTo(DateTime other) CustomTimeRange

Available on DateTime, provided by the MomentBenefits extension

Returns CustomTimeRange from this to other
rangeToMax() CustomTimeRange

Available on DateTime, provided by the MomentBenefits extension

Returns CustomTimeRange from this to other
startOf(DurationUnit unit) Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returned object will have same timezone as this
startOf(DurationUnit unit) DateTime

Available on DateTime, provided by the StartOfUnit extension

Returned object will have same timezone as this
startOfDay() DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the day
startOfDay() Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the day
startOfHour() DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the hour
startOfHour() Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the hour
startOfIsoWeek() Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the ISO week (always Monday)
startOfIsoWeek() DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the ISO week (always Monday)
startOfLastDay() Moment

Available on Moment, provided by the DayFinderMoment extension

Returns a new Moment of same timezone
startOfLastDay() DateTime

Available on DateTime, provided by the DayFinder extension

Returns a new DateTime of same timezone
startOfLastHour() DateTime

Available on DateTime, provided by the HourFinder extension

Returns a new DateTime of same timezone
startOfLastHour() Moment

Available on Moment, provided by the HourFinderMoment extension

Returns a new Moment of same timezone
startOfLastIsoWeek() Moment

Available on Moment, provided by the IsoWeekFinderMoment extension

Assumes this is in local timezone, but will preserve the timezone
startOfLastIsoWeek() DateTime

Available on DateTime, provided by the IsoWeekFinder extension

Assumes this is in local timezone, but will preserve the timezone
startOfLastLocalWeek([int? weekStart]) DateTime

Available on DateTime, provided by the LocalWeekFinder extension

Assumes this is in local timezone, but will preserve the timezone
startOfLastLocalWeek([int? weekStart]) Moment

Available on Moment, provided by the LocalWeekFinderMoment extension

Assumes this is in local timezone, but will preserve the timezone
startOfLastMinute() Moment

Available on Moment, provided by the MinuteFinderMoment extension

Returns a new Moment of same timezone
startOfLastMinute() DateTime

Available on DateTime, provided by the MinuteFinder extension

Returns a new DateTime of same timezone
startOfLastMonth() Moment

Available on Moment, provided by the MonthFinderMoment extension

Returns a new Moment of same timezone
startOfLastMonth() DateTime

Available on DateTime, provided by the MonthFinder extension

Returns a new DateTime of same timezone
startOfLastYear() DateTime

Available on DateTime, provided by the YearFinder extension

Returns a new DateTime of same timezone
startOfLastYear() Moment

Available on Moment, provided by the YearFinderMoment extension

Returns a new Moment of same timezone
startOfLocalWeek([int? weekStart]) Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the week based on localization.weekStart. You can override this with weekStart
startOfLocalWeek([int? weekStart]) DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the week based on weekStart. If it's null, it uses Moment.defaultLocalization.weekStart
startOfMillisecond() Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the millisecond
startOfMillisecond() DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the millisecond
startOfMinute() Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the minute
startOfMinute() DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the minute
startOfMonth() Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the month
startOfMonth() DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the month
startOfNextDay() Moment

Available on Moment, provided by the DayFinderMoment extension

Returns a new Moment of same timezone
startOfNextDay() DateTime

Available on DateTime, provided by the DayFinder extension

Returns a new DateTime of same timezone
startOfNextHour() Moment

Available on Moment, provided by the HourFinderMoment extension

Returns a new Moment of same timezone
startOfNextHour() DateTime

Available on DateTime, provided by the HourFinder extension

Returns a new DateTime of same timezone
startOfNextIsoWeek() Moment

Available on Moment, provided by the IsoWeekFinderMoment extension

Assumes this is in local timezone, but will preserve the timezone
startOfNextIsoWeek() DateTime

Available on DateTime, provided by the IsoWeekFinder extension

Assumes this is in local timezone, but will preserve the timezone
startOfNextLocalWeek([int? weekStart]) Moment

Available on Moment, provided by the LocalWeekFinderMoment extension

Assumes this is in local timezone, but will preserve the timezone
startOfNextLocalWeek([int? weekStart]) DateTime

Available on DateTime, provided by the LocalWeekFinder extension

Assumes this is in local timezone, but will preserve the timezone
startOfNextMinute() Moment

Available on Moment, provided by the MinuteFinderMoment extension

Returns a new Moment of same timezone
startOfNextMinute() DateTime

Available on DateTime, provided by the MinuteFinder extension

Returns a new DateTime of same timezone
startOfNextMonth() Moment

Available on Moment, provided by the MonthFinderMoment extension

Returns a new Moment of same timezone
startOfNextMonth() DateTime

Available on DateTime, provided by the MonthFinder extension

Returns a new DateTime of same timezone
startOfNextYear() DateTime

Available on DateTime, provided by the YearFinder extension

Returns a new DateTime of same timezone
startOfNextYear() Moment

Available on Moment, provided by the YearFinderMoment extension

Returns a new Moment of same timezone
startOfSecond() Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the second
startOfSecond() DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the second
startOfYear() Moment

Available on Moment, provided by the StartOfUnitMoment extension

Returns start of the year
startOfYear() DateTime

Available on DateTime, provided by the StartOfUnit extension

Returns start of the year
subtract(Duration duration) Moment
Returns new Moment with subtracted duration
override
timeZoneFormatted([bool seperateWithColon = true]) String

Available on DateTime, provided by the MomentBenefits extension

Returns timezone:
timeZoneFormatted([bool seperateWithColon = true]) String
to(DateTime other) CustomTimeRange

Available on DateTime, provided by the MomentBenefits extension

Returns CustomTimeRange from this to other
toIso8601String() String
Returns an ISO-8601 full-precision extended format representation.
inherited
toLocal() Moment
Returns this DateTime value in the local time zone.
override
toMoment({MomentLocalization? localization}) Moment

Available on DateTime, provided by the MomentBenefits extension

toString() String
Returns "LLL" formatted string
override
toUtc() Moment
Returns this DateTime value in the UTC time zone.
override

Operators

operator +(Duration duration) Moment
Returns new Moment with added duration
operator +(Duration other) → dynamic

Available on DateTime, provided by the MomentBenefits extension

Equivalent to add(other)
operator -(Duration duration) Moment
Returns new Moment with subtracted duration
operator -(Duration other) → dynamic

Available on DateTime, provided by the MomentBenefits extension

Equivalent to subtract(other)
operator <(DateTime other) → dynamic

Available on DateTime, provided by the MomentBenefits extension

Equivalent to isBefore(other)
operator <=(DateTime other) → dynamic

Available on DateTime, provided by the MomentBenefits extension

Equivalent to isBefore(other) || isAtSameMomentAs(other)
operator ==(Object other) bool
Whether other is a DateTime at the same moment and in the same time zone (UTC or local).
inherited
operator >(DateTime other) → dynamic

Available on DateTime, provided by the MomentBenefits extension

Equivalent to isAfter(other)
operator >=(DateTime other) → dynamic

Available on DateTime, provided by the MomentBenefits extension

Equivalent to isAfter(other) || isAtSameMomentAs(other)

Static Properties

defaultLocalization MomentLocalization
Any instances without explicit localization set will use the global localization.
getter/setter pair
epoch DateTime
epoch, but in the local timezone
getter/setter pair
epochUtc DateTime
epoch in UTC
getter/setter pair
maxValue DateTime
getter/setter pair
minValue DateTime
getter/setter pair

Static Methods

duration(Duration duration, {MomentLocalization? localization, bool round = true, bool omitZeros = true, bool includeWeeks = false, Abbreviation form = Abbreviation.none, String? delimiter, DurationFormat format = DurationFormat.auto, bool dropPrefixOrSuffix = false}) String
Returns precise duration for duration in localization
endOfLastHour() DateTime
End of the last hour in the local timezone
endOfLastIsoWeek() DateTime
End of the last ISO week in the local timezone
endOfLastLocalWeek([int? weekStart]) DateTime
End of the last local week in the local timezone
endOfLastMonth() DateTime
End of the last month in the local timezone
endOfLastYear() DateTime
End of the last year in the local timezone
endOfNextHour() DateTime
End of the next hour in the local timezone
endOfNextIsoWeek() DateTime
End of the next ISO week in the local timezone
endOfNextLocalWeek([int? weekStart]) DateTime
End of the next local week in the local timezone
endOfNextMonth() DateTime
End of the next month in the local timezone
endOfNextYear() DateTime
End of the next year in the local timezone
endOfThisHour() DateTime
End of the current hour in the local timezone
endOfThisIsoWeek() DateTime
End of the current ISO week in the local timezone
endOfThisLocalWeek([int? weekStart]) DateTime
End of the current local week in the local timezone
endOfThisMonth() DateTime
End of the current month in the local timezone
endOfThisYear() DateTime
End of the current year in the local timezone
endOfToday() DateTime
End of today in the local timezone
endOfTomorrow() DateTime
End of tomorrow in the local timezone
endOfYesterday() DateTime
End of yesterday in the local timezone
parse(String input, {MomentLocalization? localization}) Moment
Uses DateTime.parse
override
setGlobalLocalization(MomentLocalization localization) → dynamic
Any instances without explicit localization set will use the global localization.
startOfLastHour() DateTime
Start of the last hour in the local timezone
startOfLastIsoWeek() DateTime
Start of the last ISO week in the local timezone
startOfLastLocalWeek([int? weekStart]) DateTime
Start of the last local week in the local timezone
startOfLastMonth() DateTime
Start of the last month in the local timezone
startOfLastYear() DateTime
Start of the last year in the local timezone
startOfNextHour() DateTime
Start of the next hour in the local timezone
startOfNextIsoWeek() DateTime
Start of the next ISO week in the local timezone
startOfNextLocalWeek([int? weekStart]) DateTime
Start of the next local week in the local timezone
startOfNextMonth() DateTime
Start of the next month in the local timezone
startOfNextYear() DateTime
Start of the next year in the local timezone
startOfThisHour() DateTime
Start of the current hour in the local timezone
startOfThisIsoWeek() DateTime
Start of the current ISO week in the local timezone
startOfThisLocalWeek([int? weekStart]) DateTime
Start of the current local week in the local timezone
startOfThisMonth() DateTime
Start of the current month in the local timezone
startOfThisYear() DateTime
Start of the current year in the local timezone
startOfToday() DateTime
Start of today in the local timezone
startOfTomorrow() DateTime
Start of tomorrow in the local timezone
startOfYesterday() DateTime
Start of yesterday in the local timezone
tryParse(String input, {MomentLocalization? localization}) Moment?
Uses DateTime.tryParse
override