Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baderouaich/time_ago_provider
library for generating fuzzy timestamp for example ("9 minutes ago")
https://github.com/baderouaich/time_ago_provider
dart flutter flutter-package fuzzy-timestamps timestamp
Last synced: 13 days ago
JSON representation
library for generating fuzzy timestamp for example ("9 minutes ago")
- Host: GitHub
- URL: https://github.com/baderouaich/time_ago_provider
- Owner: baderouaich
- License: mit
- Created: 2019-04-15T21:29:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-06T08:21:15.000Z (about 1 year ago)
- Last Synced: 2024-10-12T04:06:16.045Z (29 days ago)
- Topics: dart, flutter, flutter-package, fuzzy-timestamps, timestamp
- Language: Dart
- Homepage: https://pub.dev/packages/time_ago_provider
- Size: 94.7 KB
- Stars: 16
- Watchers: 3
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# time_ago_provider
library for generating fuzzy timestamp e.g("9 minutes ago")
[![pub package](https://img.shields.io/pub/v/time_ago_provider.svg)](https://pub.dev/packages/time_ago_provider)
[![Github test](https://github.com/BaderEddineOuaich/time_ago_provider/workflows/test/badge.svg)](https://github.com/BaderEddineOuaich/time_ago_provider/actions?query=workflow%3Atest)```dart
import 'package:time_ago_provider/time_ago_provider.dart' as timeAgo;void main() {
/// Default Format (summary of elapsed time)
final nineMinutesElapsed = DateTime.now().subtract(Duration(minutes: 9));
print(timeAgo.format(nineMinutesElapsed)); // 9 minutes ago
print(timeAgo.format(nineMinutesElapsed, locale: 'en_short')); // 9 min/// Full Format (detailed elapsed time years, months, days...)
final longTimeElapsed = DateTime.now().subtract(Duration(days: 999, hours: 6, minutes: 8, seconds: 3));
print(timeAgo.formatFull(longTimeElapsed)); // 2 years, 9 months, 9 days, 6 hours, 8 minutes, 3 seconds
print(timeAgo.formatFull(longTimeElapsed, locale: 'en_short')); // 2 yr, 9 mo, 9 d, 6 h, 8 min, 3 sec/// Adding new locales
timeAgo.setLocale('de', timeAgo.German());
timeAgo.setLocale('de_short', timeAgo.German(shortForm: true));
print(time_ago.format(nineMinutesElapsed, locale: 'de')); // vor 9 Minuten
print(timeAgo.format(nineMinutesElapsed, locale: 'de_short')); // 9 Min.
}
```## Supported Languages
- [x] ENGLISH
- [x] GERMAN
- [x] POLISH
- [x] FRENCH
- [x] ARABIC
- [x] TURKISH
- [x] PORTUGUESE
- [x] ITALIAN
- [x] SWEDISH
- [x] NORWEGIAN
- [x] PERSIAN
- [x] SPANISH
- More will be added## Installing
[Package](https://pub.dartlang.org/packages/time_ago_provider)
## Contributors ✨
Thanks goes to these wonderful people!
## Features and bugs
If you face any problems feel free to open an issue at the [issue tracker][tracker]. If you feel the library is missing a feature, please raise a ticket on Github. Pull request are also welcome.
[tracker]: https://github.com/BaderEddineOuaich/time_ago_provider/issues