flutter_relative_time 0.2.0
flutter_relative_time: ^0.2.0 copied to clipboard
Human-friendly past and future DateTime formatting with localized timeago and calendar labels.
0.2.0 #
Changed #
- Converted the package core to Dart-only. Flutter apps can keep using the same API, while non-Flutter Dart code can now depend on the formatter without a Flutter SDK dependency.
Added #
- Added
RelativeTimeWeekStartandRelativeTimeFormatOptions.weekStartto choose the first day used for same-week calendar grouping. - Added
RelativeTimeYesterdayStyleandRelativeTimeFormatOptions.yesterdayStyleto choose between time-only yesterday labels and explicityesterday, {time}labels in smart mode. - Added
RelativeTimeRoundingandRelativeTimeFormatOptions.roundingto control how longer durations are converted to weeks, months, and years.
Documentation #
- Documented Dart-only package usage.
- Documented week-start, yesterday-style, and duration-rounding options.
0.1.1 #
Fixed #
- Updated smart formatting to use real calendar-week boundaries instead of
absolute day distance. A previous Saturday viewed from Monday now formats as
a date such as
1 ago, 13:20, not assáb, 13:20. - Applied the same smart grouping model consistently to past and future dates.
Added #
- Added date/time pattern overrides:
timePatternweekdayDatePatternsameMonthDatePatternsameYearDatePatternfullDatePattern
Documentation #
- Documented calendar-week behavior.
- Documented custom date and time pattern overrides.
0.1.0 #
Changed #
- Replaced the public
languageCodeparameter withlocaleacross formatter methods andDateTimeextensions. - Added locale normalization for language and region strings such as
es,es_ES,es-ES,pt_BR, anden_GB. - Updated the default smart formatter to better match product feeds and notification lists
- Preserved the requested region when falling back to built-in language messages so clock format and date formatting can remain locale-aware.
Documentation #
- Updated README examples to use
locale. - Documented the new default smart behavior.
- Documented locale string formats and custom locale usage.
0.0.1 #
Initial release.
Added #
- Added
RelativeTimeFormatterfor human-friendly past, future, and calendar date labels. - Added nullable
DateTimeextensions:toRelativeTime()toTimeAgo()toRelativeCalendar()
- Added formatting modes:
smarttimeAgocalendar
- Added support for very recent values such as
just nowandsoon. - Added future labels such as
in 2h,tomorrow, 05:03, andmañana, 05:03. - Added past labels such as
5m ago,hace 5 min, andhá 2 horas. - Added automatic 12h/24h clock selection from the effective language or locale code.
- Added explicit clock format selection with:
RelativeTimeClockFormat.autoRelativeTimeClockFormat.twelveHourRelativeTimeClockFormat.twentyFourHour
- Added guaranteed two-digit hours when 24h format is selected, for example
05:03. - Added built-in locale messages for Arabic, German, English, Spanish, French, Italian, Portuguese, Russian, and Chinese.
- Added per-call message overrides.
- Added custom locale injection through
RelativeTimeFormatOptions.locales. - Added documentation and examples for future, past, and very recent dates.
- Added a Flutter example app with interactive language and clock format controls.
- Added MIT License.