Changelog
Release notes for every version of flutter_date_formatter, from CHANGELOG.md. Versions follow pub.dev.
v0.2.0
Added
DateTime.formatRangeandFlutterDateFormatter.formatDateTimeRangefor smart localized date ranges, including compact same-month output such asMar 1–5, 2025.FlutterDateFormatter.parseAnyandparseAnyDetailedfor trying multiple input patterns, with per-pattern diagnostics for import and validation flows.- Date range presets in the documentation Playground for same-day, same-month, cross-month and cross-year examples.
- Documentation for local and UTC
DateTimebehavior without bundling a timezone database. - Expanded Playground sharing and copying fallback for browsers without the Clipboard API.
Changed
- Vietnamese short duration units now use compact localized forms such as
1n 2g.
Documentation
- Added interactive date range and locale examples.
- Documented
parseAny,parseAnyDetailed, Vietnamese compact duration units, region-qualified locales and timezone boundaries.
v0.1.0
Fixed
- Literal text in
intlquotes works in patterns:dd/MM/yyyy 'at' HH:mmnow gives07/10/2025 at 09:35instead of07/10/2025 'AMt' 09:35.''is a literal apostrophe, and[text]keeps working (an apostrophe inside brackets stays literal). FlutterDateFormatterinstances can be reused; the secondformat()call no longer throwsLateInitializationError.- Formatting works without calling
initializeDateFormatting()first, keeps the requested region (en_GB,pt_BR), and throws aFormatExceptionfor a blank pattern. - Locale lookup accepts any case and BCP-47 tags (
zh-cn,pt-BR), uses the fullIntl.defaultLocale, and falls back to the language code. registerLocalenow also affects relative formatting;isLocaleSupportedworks for region-qualified codes.- Registered
sk,ms,el(Greek,grkept as alias),zh_TWandzh_HK; removed themn_MYtypo. - Week APIs (
dayOfWeek,startOfWeek,weekOfYear, ...) no longer throw for locales such asde_DE,vi_VN,en-USorC. weekOfYearnow returns the ISO-8601 week number.- Day and week arithmetic,
startOf/endOf(Unit.week),isYesterday/isTomorrowanddiffin days/weeks are correct across daylight saving time. startOfQuarter/endOfQuarterno longer overflow into the wrong month;clone()keeps microseconds;indexOfClosestDaycompares at microsecond resolution.TimeSpan: fixedintersects,merge,getDifferenceandsymmetricDifference; addedgetDifferences,==,hashCodeandtoString.- Relative time: equal dates are formatted as past, and values just below a threshold no longer show the next bucket's number (e.g. "45 minutes", "12 months").
- Translation, plural and ordinal fixes in about 35 locales, including ar, az, be, bn, bs, cs, de, el, fr, hi, hr, hu, ku, lv, my, pl, ro, ru, sk, sr, sv, th, ko and zh.
Added
DateFormatterConfig.configurefor a default locale, a start-of-week override and an injectable clock used by every "now"-dependent API (isToday,formatFromNow, ...).- Calendar-style formatting:
formatCalendar("Today at 3:00 PM", "Yesterday at …", "Last Monday at …") with locale strings for all supported locales, ported from moment.js and checked against CLDR. Weekdays are worded relative to the current week of the locale (e.g.本周三/上周三). - Duration humanization:
Duration.humanize/FlutterDateFormatter.formatDuration("2 hours 5 minutes", "2h 5m") withmaxUnits, unit limits and locale strings. - Parsing:
FlutterDateFormatter.parseandtryParse, using the same pattern syntax asformat(includingdoordinals), withstrictandutcoptions. - Ranges:
DateTime.rangeToandTimeSpan.iterate(calendar steps, DST-safe); comparison helpersclamp,earliestandlatest. - Optional locale hooks
calendarDateTime(),durationUnits()andshortDurationUnits()onDateFormatterLocale, falling back to English. DirectionalRelativeDateTime, an optional interface for locales whose unit texts depend on the direction (past or future). Czech and Slovak use it.TimeSpan.getDifferences, which returns every remaining part, andconst TimeSpan.fromStart.pubspec.yaml:repository,issue_trackerandtopics.
Changed
- Lint rules now follow
very_good_analysis7.0.0, and CI fails on infos. - CI also runs the tests in a time zone with daylight saving time and analyzes with the lowest supported dependencies; publishing runs CI first.
Deprecated
Localeis renamed toDateFormatterLocaleto avoid clashing with Flutter'sLocale. The old name remains as a deprecated typedef.
v0.0.9
Added
-
DateTime Extension: Closest Day and TimeSpan Support:
- Added
indexOfClosestDayandclosestDayTomethods toDateTimeextension. - These methods allow finding the closest day to a given
DateTimefrom an iterable ofDateTimeobjects. - Added the
TimeSpanclass:fromStart,fromEndandfromCenterconstructors,start,end,middleandtotalDuration, thewith*copy methods,contains,containsTimeSpan,intersects,isSame,isBefore/isAfter(andOrSamevariants),merge,getIntersection,getDifferenceandsymmetricDifference. - Added
isWithinandisWithinTimeSpantoDateTime.
- Added
-
DateTime Extension: Quarters:
- Added
startOfQuarterandendOfQuarter.
- Added
-
DateTime Extension: Diff and Clone Methods:
- Added
diffInDays,diffInSeconds, andclonemethods toDateTimeextension. diffInDays: Calculates the difference between twoDateTimeobjects in days.diffInSeconds: Calculates the difference between twoDateTimeobjects in seconds.clone: Returns a newDateTimeobject that is a copy of the original.
- Added
-
Locale Support:
- Added support for adding or overriding custom locales in the application.
- Users can now define their own locales or extend existing ones to suit custom formatting needs.
v0.0.8
- Fix ordinal for EN locale
v0.0.7
-
New Properties:
isFuture,isPast,isToday,isYesterday,isTomorrow: Check the time relative to the current date.isLocal,isWeekend,isLeapYear: Check specific characteristics of the date (e.g., weekend, leap year).dayOfWeek,dayOfYear,weekOfYear,quarterOfYear: Information about the day, week, and month of the year.startOfDay,startOfWeek,startOfMonth,startOfYear: Get the start time of a unit of time (day, week, month, year).endOfDay,endOfWeek,endOfMonth,endOfYear: Get the end time of a unit of time.
-
New Methods:
endOf(),startOf(): Get the start or end time of a time unit.sub*()andadd*()(e.g.,subYears(),addMonths()): Add or subtract time from the current date.diff(),isSame(),isBetween(): Compare two dates.format(),formatRelative(),formatFromNow(): Format the date/time into a string, supporting relative time formats.
v0.0.6
- Get default locale for intl and mapping with supported locale config
- Remove
toLowerCase()when mapping locale
v0.0.5
- Remove print log
v0.0.4
- Add
ordinalfunction returns the ordinal number for the given [n] in the specified [locale]
v0.0.3
- Fix bug
withPrefixAndSuffixparam not working
v0.0.2
- Add
withPrefixAndSuffixparam forformatRelativeDateTimefunction - Support short relative date time for ES locale
- Support locale (Georgian - ka, Pashto - ps, Tagalog - tl_PH)
v0.0.1
- Initial release