New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
intl package: add CLDR-based duration / age formatting #332
Comments
<img src="https://avatars.githubusercontent.com/u/5449880?v=3" align="left" width="48" height="48"hspace="10"> Comment by iposva-google |
<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="48" height="48"hspace="10"> Comment by sethladd Added Pkg-Intl label. |
When will this be implemented? |
Still no update on this? |
This issue is still relevant today. These packages provide relative time (e.g. "5 days ago"): Their implementation is pretty good from what I can tell though it would be much nicer to have access to this right inside intl. However, the only package I can find for directly formatting durations: |
This is a long-term goal, pending unicode-org/icu4x#801 and the addition of duration formatting into ECMA402. We can then expose this through |
<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="96" height="96"hspace="10"> Issue by seaneagan
Originally opened as dart-lang/sdk#11075
The intl package currently has unimplemented methods on DateFormat for this called formatDuration and formatDurationFrom. This is the wrong location for these APIs. Arbitrary DateFormat patterns don't match up to the corresponding CLDR data model.
The intlx package (http://pub.dartlang.org/packages/intlx) has DurationFormat which formats Durations, e.g. "5 minutes" or "5 min" and AgeFormat which formats DateTimes offset from now, e.g. "In 5 minutes" or "5 minutes ago" using CLDR data. See the following:
Demo: http://seaneagan.me/intlx/
Docs:
http://seaneagan.me/intlx/docs/intlx/DurationFormat.html
http://seaneagan.me/intlx/docs/intlx/AgeFormat.html
Proposal: move DurationFormat and AgeFormat to intl package and remove DateFormat.formatDuration/formatDurationFrom.
The text was updated successfully, but these errors were encountered: