timeago 1.1.0 copy "timeago: ^1.1.0" to clipboard
timeago: ^1.1.0 copied to clipboard

outdatedDart 1 only

A library useful for creating fuzzy timestamps. (e.g. "15 minutes ago")

timeago #

A library useful for creating fuzzy timestamps. (e.g. "5 minutes ago")

Pub

Build Status

Usage #

import 'package:timeago/timeago.dart';

main() async {
    TimeAgo ta = new TimeAgo();
    final fifteenAgo = new DateTime.now().subtract(new Duration(minutes: 15));
    final fifteenFromNow = new DateTime.now().add(new Duration(minutes: 15));
    
    print(ta.format(fifteenAgo)); // 15 minutes ago
    print(ta.format(fifteenFromNow, until: true)); // 15 minutes from now
    
    // There's also a shorthand for a default time ago object
    print(timeAgo(new DateTime.now())); // just a moment ago
    
    
    // Load locale messages, only need to do this once per locale
    await TimeAgo.initializeLocale("es");
    
    // Change locale
    ta.locale = 'es';
    
    print(ta.format(fifteenAgo)); // hace 15 minutos
    print(ta.format(fifteenFromNow, until: true)); // dentro de 15 minutos
    
}

Live Demo #

Here

To do #

  • Add more locales

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1824
likes
0
pub points
100%
popularity

Publisher

unverified uploader

A library useful for creating fuzzy timestamps. (e.g. "15 minutes ago")

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

intl

More

Packages that depend on timeago