timeago
3.7.1, released 2 years ago by an unverified publisher
Humanize dates into fuzzy timestamps like "15 minutes ago"
What it does
Provides a single format function that converts a DateTime into a human‑readable relative string. It ships with English and Spanish messages and allows adding or overriding locales via setLocaleMessages.
AI-written summary of version 3.7.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a quick relative time display in a UI
- You want to support multiple languages without pulling in a heavy i18n library
- You prefer a small, dependency‑free package for date formatting
Skip it when
- You need full locale‑aware date formatting with plural rules
- You require complex calendar or timezone handling beyond simple relative strings
Strengths
- Simple API – one function call
- Extensible locale system – add custom messages
- No runtime dependencies – lightweight
Weaknesses
- Limited to relative time strings only
- Only basic plural handling – not full i18n
- Requires manual locale registration for additional languages
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add to pubspec and import package: import 'package:timeago/timeago.dart' as timeago;
import 'package:timeago/timeago.dart' as timeago;
void main() {
final fifteenAgo = DateTime.now().subtract(Duration(minutes: 15));
print(timeago.format(fifteenAgo)); // 15 minutes ago
print(timeago.format(fifteenAgo, locale: 'es')); // hace 15 minutos
}
Alternatives
Packages that do the same job and could replace timeago.
- flutter_timeago_pro
Formats nullable DateTime into human‑friendly relative or absolute timestamps.
66Compare - get_time_ago
Relative time formatting for Dart and Flutter supporting 22 locales and CLDR plurals.
82Compare - time_ago_provider
Generate fuzzy timestamps like "9 minutes ago" in many languages
46Compare - android_notification_icons
Generate Android notification icons from a source image
50Compare
Works with
Packages commonly used together with timeago: ones it builds on, ones built on it, and its own family.
- intltimeago depends on itA Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
- dart_dateBuilt on timeagoDate manipulation library providing DateTime extensions and an Interval object.
- timeago_flutterBuilt on timeagoFlutter widgets and helpers to convert dates into humanized fuzzy timestamps like '15 minutes ago'.
- inspireuiBuilt on timeagoA collection of e‑commerce widgets and utilities for Flutter apps.
- v_story_viewerBuilt on timeagoA high-performance Flutter story viewer package inspired by Instagram and WhatsApp stories.
- simple_pollsBuilt on timeagoA Flutter widget for creating localized polls with Material 3 styling.