time_ago_provider 2.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 92

time_ago_provider #

library for generating fuzzy timestamp e.g("9 minutes ago")

import 'package:time_ago_provider/time_ago_provider.dart' as timeAgo;

void main() {
  /// Get the timestamp
  final nineMinutesElapsed = DateTime.now().subtract(Duration(minutes: 9));

  /// Format & get elapsed String
  print(timeAgo.format(nineMinutesElapsed)); // 9 minutes ago
  print(timeAgo.format(nineMinutesElapsed, locale: 'en_short')); // 9 min

  /// Adding new locales
  timeAgo.setLocale('de', timeAgo.German());
  timeAgo.setLocale('de_short', timeAgo.German(shortForm: true));
  print(timeAgo.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
  • More will be added

Installing #

Package

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. If you feel the library is missing a feature, please raise a ticket on Github. Pull request are also welcome.

0.0.1 #

  • Initial version.

0.1.0 #

  • Stable version.

0.1.1 #

  • Code improved.

1.0.0 #

  • Method's Parameter (timeStamp) is now required.

1.0.1 #

  • Example Edited.

1.0.2 #

  • README.md Edited.

1.0.3 #

  • README.md Edited 1.

2.0.0 #

  • Languages Abstraction

2.0.1 #

  • Added Doc Comments

2.0.2 #

  • Added Arabic, French Language Support

2.0.3 #

2.0.4 #

  • Formatted documents

2.0.5 #

  • Added Polish Language Support

example/time_ago_provider_example.dart

import 'package:time_ago_provider/time_ago_provider.dart' as timeAgo;

void main() {
  /// Get the timestamp
  final nineMinutesElapsed = DateTime.now().subtract(Duration(minutes: 9));

  /// Format & get elapsed String
  print(timeAgo.format(nineMinutesElapsed)); // 9 minutes ago
  print(timeAgo.format(nineMinutesElapsed, locale: 'en_short')); // 9 min

  /// Adding new locales
  timeAgo.setLocale('de', timeAgo.German());
  timeAgo.setLocale('de_short', timeAgo.German(shortForm: true));
  print(timeAgo.format(nineMinutesElapsed, locale: 'de')); // vor 9 Minuten
  print(timeAgo.format(nineMinutesElapsed, locale: 'de_short')); // 9 Min.
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  time_ago_provider: ^2.0.5

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:time_ago_provider/time_ago_provider.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
84
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

We analyzed this package on Jul 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0