Giter Site home page Giter Site logo

time_ago_provider's Introduction

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() {
  /// Default Format (summary of elapsed time)
  final nineMinutesElapsed = DateTime.now().subtract(Duration(minutes: 9));
  print(time_ago.format(nineMinutesElapsed)); // 9 minutes ago
  print(time_ago.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(time_ago.formatFull(longTimeElapsed)); // 2 years, 9 months, 9 days, 6 hours, 8 minutes, 3 seconds
  print(time_ago.formatFull(longTimeElapsed, locale: 'en_short')); // 2 yr, 9 mo, 9 d, 6 h, 8 min, 3 sec

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

Supported Languages

  • ENGLISH
  • GERMAN
  • POLISH
  • FRENCH
  • ARABIC
  • TURKISH
  • PORTUGUESE
  • ITALIAN
  • 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.

time_ago_provider's People

Contributors

baderouaich avatar l7ssha avatar bgoktugozdemir-dev avatar veneno261 avatar andreasusego avatar hacioguz avatar luizeof avatar tommasoazz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.