moment_dart
Multi-purpose immutable DateTime subclass. Supports multiple localizations to easily convert DateTime and Duration into human-readable format
5.3.4
14K downloads/mo
#2549 most downloaded on pub.dev
sadespresso/moment_dart
What this package is like to depend on
Last release 3 months ago
03 May 2026
Release timing varies
gaps range from 8 days to 4 months
Nearly every release is documented
notes for 82 of 82 stable releases
3 versions withdrawn
withdrawn after publishing
5 years old
86 releases · first in 2022
7 releases in the last 12 months
see the full history below
Release timeline
86 releases · Feb 2022 to May 2026Releases
latest 60 of 86-
5.3.403 May 2026Release notes
Open source →- Fixed several DST-related off-by-one bugs in
startOf/endOfweek helpers and theirnext/lastvariants. - Fixed
Moment.calendar()returning the wrong relative day whenmomentandreferencehad different timezones. - Fixed
Moment.timeZoneFormatted()output for negative offsets (now properly zero-padded, e.g.-05:00). - Renamed misspelled
Calender*types andcalender*constants toCalendar*/calendar*. Old names remain as@Deprecatedaliases. - Misc typo fixes.
- Fixed several DST-related off-by-one bugs in
-
5.3.302 May 2026 -
5.3.219 Apr 2026 -
5.3.112 Feb 2026 -
5.3.002 Oct 2025Release notes
Open source →What's Changed
- Master by @sadespresso in #48
- Master by @sadespresso in #49
- add ru-RU locale by @muhammadyusuf-kurbonov in #50
- Master by @sadespresso in #51
New Contributors
- @muhammadyusuf-kurbonov made their first contribution in #50
Full Changelog: 5.2.2...5.3.0
-
5.3.0+103 Oct 2025 -
5.2.407 Sep 2025Release notes
Open source →- Fix: TimeRange.format() now respects
useRelative=falsefor custom time ranges.
- Fix: TimeRange.format() now respects
-
5.2.330 Apr 2025Release notes
Open source →- Arabic (ar_PS) ordinals to return the number. (I don't know any Arabic, ur welcome to submit a PR)
-
5.2.222 Apr 2025Release notes
Open source →What's Changed
- Arabic localization by @Ultrate in #43
- Added TimeRange.intersect(other) (You can also turn a.intersect(b) as a & b)
- Added TimeRange.toCustom() and TimeRange.asCustom
New Contributors
Full Changelog: 5.0.1...5.2.2
-
5.2.119 Apr 2025Release notes
Open source →- Added
TimeRange.intersect(other)(You can also turna.intersect(b)asa & b) - Added
TimeRange.toCustom()andTimeRange.asCustom
- Added
-
5.2.019 Apr 2025 -
5.1.012 Apr 2025 -
5.0.101 Apr 2025Release notes
Open source →What's Changed
- Clamped setters - set of functions that clamps the value to prevent DateTime's default overflowing.
- All time ranges'
toproperty is now inclusive (except local/iso week and CustomTimeRange, cause they were inclusive already) - This also means DayTimeRange(...).duration will now return exactly 1 less microsecond.
I am sorry for this change.
Full Changelog: 4.1.0...5.0.1
Release notes
Open source →-
[BREAKING] All time ranges'
tois now inclusive, same asCustomTimeRangeand local/iso week ranges. It also means non-custom or non-week time ranges.durationwill now have one less microsecond.Affected classes are:
- HourTimeRange
- DayTimeRange
- MonthTimeRange
- YearTimeRange
-
5.0.001 Apr 2025 withdrawn -
4.1.028 Mar 2025Release notes
Open source →Release notes
Open source →- Added clamped setters that prevents DateTime's overflowing behaviour
DateTime.setClampedSecondDateTime.setClampedMinuteDateTime.setClampedHourDateTime.setClampedDayDateTime.setClampedMonth
- Added clamped setters that prevents DateTime's overflowing behaviour
-
4.0.117 Feb 2025Release notes
Open source →What's Changed
- [BREAKING]
TimeRangemonth translation now includes the year, but year is omitted whenuseRelativeis true andanchor.yearis same as the range year - Added
Moment.minValueUtcandMoment.maxValueUtc - Fixed
Moment.minValueandMoment.maxValueoverflowing - Updated docs
Full Changelog: 3.1.0...4.0.1
- [BREAKING]
-
4.0.016 Feb 2025Release notes
Open source →- [BREAKING] TimeRange month translation now includes the year
- But year is omitted when
useRelativeis true andanchor.yearis same as the range year
- But year is omitted when
- Added
Moment.minValueUtcandMoment.maxValueUtc - Fixed
Moment.minValueandMoment.maxValueoverflowing
- [BREAKING] TimeRange month translation now includes the year
-
3.3.208 Feb 2025Release notes
Open source →- Removed
DateTime.toas per it's deprecated, useDateTime.rangeToinstead.
- Removed
-
3.3.125 Jan 2025Release notes
Open source →What's new
- Fixed MonthTimeRange.format() would return "This month" for different year's same month
Full Changelog: 3.3.0...3.3.1
Release notes
Open source →- Fixed MonthTimeRange.format() would return "This month" for different year's same months.
-
3.3.023 Jan 2025Release notes
Open source →What's new
- Pageable TImeRange's
next,lastno longer generated invalid value (e.g., month 12, day 32, etc..)
Full Changelog: 3.2.1...3.3.0
Release notes
Open source →- Fixed where
PageableRange.nextand/orPageableRange.lastcould end up with illegal values such as month=13, day=32, etc...
- Pageable TImeRange's
-
3.2.116 Jan 2025 -
3.2.016 Jan 2025Release notes
Open source → -
3.1.012 Jan 2025Release notes
Open source →What's Changed
TimeRangenow has aunitproperty that returns its corresponding
DurationUnit type if available.
Full Changelog: 3.0.0...3.1.0
Release notes
Open source →TimeRangenow has aunitproperty that returns its corresponding DurationUnit type if available.
-
3.0.031 Dec 2024Release notes
Open source →This release has breaking changes!
- Changed
TimeRange.toString()delimiter to@ - Fixed CustomTimeRange not being able to be parsed
- Added
.encode()and.encodeShort()methods onTimeRange - Added
TimeRange.fromStartAndDurationconstructor
- Changed
-
2.2.122 Dec 2024Release notes
Open source →- Added
TimeRangereadable format. - Fixed German (de_DE) full abbreviations were in English
- Added
DateTime.isMidnighthelper
- Added
-
2.2.1+beta.021 Jul 2024Release notes
Open source →- Added
TimeRangereadable format. - Fixed German (de_DE) full abbreviations were in English
- Added
DateTime.isMidnighthelper
- Added
-
2.2.020 Jul 2024Release notes
Open source →- Fixed
.endOf(DurationUnit.week)was incorrectly returning 7 days ahead #19 - Renamed
DateTime.toto.rangeTofor clarity. Old method will be removed on the next released. - Added
Moment.maxValueandMoment.minValue. For example, now you can useCustomTimeRange(now, Moment.maxValue)orepoch.to(Moment.maxValue)
- Fixed
-
2.1.018 Apr 2024Release notes
Open source →- Fixed
LocalWeekTimeRangeandIsoWeekTimeRange'stobeing 1 microsecond ahead - Now you can parse/serialize
TimeRangeby callingTimeRange.parse()andTimeRange.toString()
- Fixed
-
2.0.203 Mar 2024 -
2.0.103 Mar 2024Release notes
Open source →- TimeRange
- [BREAKING] Renamed all variable/methods with "prev" to "last"
- Added
HourTimeRange,LocalWeekTimeRangeandIsoWeekTimeRange, alongside with the static constructors - [BREAKING] TimeRange's
tois now exclusive. This meansDayTimeRange().durationwill equal toDuration(days:1)unless there's a daylight saving going on. - Added next/last getters on some TimeRange classes.
- [BREAKING] Removes deprecated formatter tokens
YYYYYYandY Moment.relative constructors- [BREAKING] Renamed all variable/methods with "prev" to "last"
- Added
Moment.startOfThisLocalWeek(), withendOfandnext/prevvariants - Added
Moment.startOfThisIsoWeek(), withendOfandnext/prevvariants - Added
Moment.startOfThisHour(), withendOfandnext/prevvariants
- Added relative finder methods such as
.startOfNextDay(). - Added
.startOfIsoWeek()and.endOfIsoWeek() - Exposes
DateTimeConstructors(no longer need to import)
- TimeRange
-
2.0.003 Mar 2024 withdrawnNothing published for this version
-
1.2.001 Mar 2024Release notes
Open source →- Added getter/method to check if
DateTimeis in the past or futureDateTime.isPastDateTime.isPastAnchored(DateTime anchor)DateTime.isFutureDateTime.isFutureAnchored(DateTime anchor)
- Added
Moment.startOfToday()- and similar ones for current month and year,
- and
endOf-variants
- Added
TimeRange. Can be constructed in multiple ways:TimeRange.today()and similar ones for current month and year- Create one of
YearTimeRange,MonthTimeRange,DayTimeRangeor CustomTimeRangefor custom from/to values.
- Added getter/method to check if
-
1.1.102 Feb 2024 -
1.1.018 Oct 2023 -
1.0.128 Aug 2023 -
1.0.028 Aug 2023Release notes
Open source →Features breaking changes
- Now requires Dart v2.19.4
- Added {reference} argument to
ComplexCalendarmethods- This fixes incorrect results of localizations that use
ComplexCalender(i.e., zh_CN, it_IT)
- This fixes incorrect results of localizations that use
- Renamed
UnitStringFormtoAbbreviation - Renamed
LocalizationKotoLocalizationKoKrfor consistency - Removed deprecated methods
- Removed
weekStartfromMoment().calendar()as it's not used. I don't know why I put it there, I don't drink alcohol, maybe I was just tired I guess - Added
DateTimeConstructors.nowWithTimezoneconstructorMoment().fromNow()andMoment.fromNowPrecise()now matches timezone withthis. Meaning, anchor will be set to UTC timezone ifthisis in UTC timezoneMoment().calendar()now matches timezone withthis. Meaning, anchor will be set to UTC timezone ifthisis in UTC timezone
DateTimeConstructors.withTimezonenow requiresisUtcas a positional argument- Added getter
Moment().hasExplicitLocalizationto check if that instance have any explicit localization - Added Japanese localization
- Bugfixes
.startOf*now returns correct timezone DateTime- [zh-CN] fixed this week was wrongly displayed as last week in
Moment().calendar()
-
1.0.0-rc.126 Aug 2023 pre-releaseRelease notes
Open source →Features breaking changes
- Added {reference} argument to
ComplexCalendarmethods- This fixes incorrect results of localizations that use
ComplexCalender(i.e., zh_CN, it_IT)
- This fixes incorrect results of localizations that use
- Renamed
LocalizationKotoLocalizationKoKrfor consistency - Removed deprecated methods
- Removed
weekStartfromMoment().calendar()as it's not used. I don't know why I put it there, I don't drink alcohol, maybe I was just tired I guess - Added
DateTimeConstructors.nowWithTimezoneconstructorMoment().fromNow()andMoment.fromNowPrecise()now matches timezone withthis. Meaning, anchor will be set to UTC timezone ifthisis in UTC timezoneMoment().calendar()now matches timezone withthis. Meaning, anchor will be set to UTC timezone ifthisis in UTC timezone
DateTimeConstructors.withTimezonenow requiresisUtcas a positional argument- Added getter
Moment().hasExplicitLocalizationto check if that instance have any explicit localization - Added Japanese localization
- Bugfixes
.startOf*now returns correct timezone DateTime- [zh-CN] fixed this week was wrongly displayed as last week in
Moment().calendar()
- Added {reference} argument to
-
0.18.119 Jul 2023Release notes
Open source →DateTime.isSameLocalWeekAs()now uses default localization's week start ifweekStartis omitted. Closes #11
-
0.18.019 Jul 2023Release notes
Open source →differenceInDaysno longer forces local timezone- Added
dategetter, returns Date with hours, minutes, etc set to 0. - Added new constructor:
DateTimeConstructors.dateWithTimezone
-
0.17.514 Jul 2023Release notes
Open source →- Calendar now accepts
DateTimeas reference - Documentation work has begun.
- See docs
- See repo on GitHub
- Calendar now accepts
-
0.17.412 Mar 2023Release notes
Open source →- Fixed extensions, and operations copying default localization when the instance had no explicit localization
-
0.17.207 Mar 2023 -
0.17.128 Feb 2023Release notes
Open source →- Fixed #9
- mn_MN, mn_Mong_MN, mn_Qaaq_MN locales now use
HHinstead ofHinLT,LTSformatters - Added 3 extension getter for
MomentandDateTimeobjects..hour12.isAm.isPm
-
0.17.018 Feb 2023 -
0.16.022 Jan 2023Release notes
Open source →This release has breaking changes!
Duration().toDurationString()first argument is now named, and optional. When null, uses global localization set usingMoment.setGlobalLocalization(MomentLocalization)- Now
weekStartofDateTime().startOfLocalWeek([int weekStart])is nullable, and defaults toMoment.defaultLocalization.weekStart - Now
weekStartofDateTime().endOfLocalWeek([int weekStart])is nullable, and defaults toMoment.defaultLocalization.weekStart
-
0.15.014 Jan 2023Release notes
Open source →- Now it's possible to set global localization with
Moment.setGlobalLocalization(MomentLocalization) - Renamed
Moment.localizationtoMoment._localization, making it private, and nullable. However, this shouldn't be breaking change asMoment.localizationgetter is introduced. Getter returns instances' localization, or global localization in case the instance doesn't have set localization
- Now it's possible to set global localization with
-
0.14.029 Dec 2022Release notes
Open source →This release has breaking changes!
- [BREAKING] moment.format("YY") now no longer throws exception when year doesn't fall in range (1970, 2030). Instead, it returns full year. e.g.,
DateTime(1969).format("YY"); // 1969 - [BREAKING] moment.format("gg") now no longer throws exception when ISO week year doesn't fall in range (1970, 2030). Instead, it returns full year. e.g.,
DateTime(1969).format("gg"); // 1969 - [BREAKING]
DateTime.format(...)now expect named arguments instead of optional positional arguments
- [BREAKING] moment.format("YY") now no longer throws exception when year doesn't fall in range (1970, 2030). Instead, it returns full year. e.g.,
-
0.13.008 Dec 2022Release notes
Open source →This release has breaking changes!
- [BREAKING]
endOf_()andstartOf_()now preserves the timezone instead of always returning localDateTimeobject endOf(DurationUnit.microsecond)andstartOf(DurationUnit.microsecond)now returnsthis.clone()instead of throwing error
- [BREAKING]
-
0.12.023 Nov 2022Release notes
Open source →This release has breaking changes!
- [BREAKING]
isAtSameUnit___As(other)now doesn't take timezones into account. If you want the old behaviour, useisAtSameUnit___As(other, enforceUTC: true) - [BREAKING] Renamed
MomentLocalizations.deDE()to.de() - [BREAKING] Removed
Moment().elapsed()for sake ofMoment().fromPrecise() - [BREAKING] Now
startOf_()andendOf_()no longer converts to local timezone. It just "assumes" it is in local timezone. - All localizations are now lazy-loaded Singletons
- [BREAKING]
-
0.11.022 Nov 2022Release notes
Open source →- Calendar no longer includes time when the date is too distant (distant that it's formatted with 'l' token)
- Added localization
zn_CN - Added
DateTime.startOfLocalWeek(int weekStart),Moment.startOfLocalWeek(), endOf counterparts
-
0.10.511 Nov 2022 -
0.10.402 Nov 2022Release notes
Open source →- isSameAs_() functions timezone now depend on
otherargument. Ifotheris UTC,thiswill be converted to UTC, elsethiswill be adjusted withother.timeZoneOffset
- isSameAs_() functions timezone now depend on
-
0.10.301 Oct 2022Release notes
Open source →- Added
.format()and other functions as extension onDateTimeobjects .format()now takes another optional argumentforceLocal, to convert the DateTime before formatting.
- Added
-
0.10.228 Sep 2022 -
0.10.127 Aug 2022 -
0.10.027 Aug 2022Release notes
Open source →- Introduced concept of
UnitString, a wrapper class for unit translations. For example, UnitString for minute may look like "19 minutes", "19 min", "19m" depending on theUnitStringForm(full, mid, short respectively)Moment.from(...)andMoment.fromNow(...)now takesformargument, which can alter the output. Defaults toUnitStringForm.full
- Introduced
Moment.fromPrecise(...),Moment.fromNowPrecise(...),Moment.duration(...)for more precise durations - German (de_DE) relative duration now shows correct forms when prefixes/suffixes are omitted
- Removed deprecated functions
- Introduced concept of
-
0.9.007 Aug 2022 withdrawnRelease notes
Open source →- Added demo. Check it out
- Localization
- Renamed all localization files to their corresponding localization ID
- Renamed all localization classes to their corresponding localization ID
- Added static method
MomentLocalizations.byLanguage()andMomentLocalizations.byLocale()
- Fixed Italian localization data
-
0.9.0+107 Aug 2022 -
0.8.228 Jul 2022 -
0.8.2+107 Aug 2022