Durations
Duration.humanize turns a Duration into text such as "1 day 2 hours" or "1d 2h 5m", with the correct plural forms in every locale.
Duration.humanize
Units with a zero count are skipped, and the rest is truncated after maxUnits. largestUnit and smallestUnit limit the units used, from Unit.week down to Unit.second.
LOADING…
⚙ TRY IT
⚡ OUTPUT
const duration = Duration(days: 1, hours: 2, minutes: 5, seconds: 9);
duration.humanize(locale: 'en');
FlutterDateFormatter.formatDuration(duration, …) is the same function as a static method.
Plural forms
Each locale has standalone (nominative) unit forms with full CLDR plural rules, checked against the Unicode CLDR data: German "5 Tage", Russian "1 минута / 2 минуты / 5 минут", Latvian "11 minūšu".
LOADING…
⚡ OUTPUT