flutter_relative_time 0.2.0 copy "flutter_relative_time: ^0.2.0" to clipboard
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 RelativeTimeWeekStart and RelativeTimeFormatOptions.weekStart to choose the first day used for same-week calendar grouping.
  • Added RelativeTimeYesterdayStyle and RelativeTimeFormatOptions.yesterdayStyle to choose between time-only yesterday labels and explicit yesterday, {time} labels in smart mode.
  • Added RelativeTimeRounding and RelativeTimeFormatOptions.rounding to 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 as sáb, 13:20.
  • Applied the same smart grouping model consistently to past and future dates.

Added #

  • Added date/time pattern overrides:
    • timePattern
    • weekdayDatePattern
    • sameMonthDatePattern
    • sameYearDatePattern
    • fullDatePattern

Documentation #

  • Documented calendar-week behavior.
  • Documented custom date and time pattern overrides.

0.1.0 #

Changed #

  • Replaced the public languageCode parameter with locale across formatter methods and DateTime extensions.
  • Added locale normalization for language and region strings such as es, es_ES, es-ES, pt_BR, and en_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 RelativeTimeFormatter for human-friendly past, future, and calendar date labels.
  • Added nullable DateTime extensions:
    • toRelativeTime()
    • toTimeAgo()
    • toRelativeCalendar()
  • Added formatting modes:
    • smart
    • timeAgo
    • calendar
  • Added support for very recent values such as just now and soon.
  • Added future labels such as in 2h, tomorrow, 05:03, and mañana, 05:03.
  • Added past labels such as 5m ago, hace 5 min, and há 2 horas.
  • Added automatic 12h/24h clock selection from the effective language or locale code.
  • Added explicit clock format selection with:
    • RelativeTimeClockFormat.auto
    • RelativeTimeClockFormat.twelveHour
    • RelativeTimeClockFormat.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.
1
likes
160
points
250
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Human-friendly past and future DateTime formatting with localized timeago and calendar labels.

Homepage

License

MIT (license)

Dependencies

intl

More

Packages that depend on flutter_relative_time