timeago 0.1.1 timeago: ^0.1.1 copied to clipboard
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")
Usage #
import 'package:timeago/timeago.dart';
main() async {
TimeAgo time = new TimeAgo();
int current = new DateTime.now().millisecondsSinceEpoch;
print(time.timeAgo(current - (15 * 60 * 1000))); // 15 minutes ago
print(time.timeUntil(current - (15 * 60 * 1000))); // 15 minutes from now
//change locale to spanish
await time.changeLocale("es");
print(time.timeAgo(current - (15 * 60 * 1000))); // hace 15 minutos
print(time.timeUntil(current - (15 * 60 * 1000))); // dentro de 15 minutos
}
Live Demo #
To do #
- Add more locales
Features and bugs #
Please file feature requests and bugs at the issue tracker.