whenwas 1.1.0
whenwas: ^1.1.0 copied to clipboard

Dart native js
Flutter Android iOS Linux macOS web Windows

Calculates how many years, months, days, ... ago a DateTime is.

Whenwas #

Library to calculate how many years, months, days, ... ago a given DateTime is.

Usage #

import 'package:whenwas/whenwas.dart';

main() {
  int year = 2000;
  var date = DateTime(year);
  
  // x years ago
  print(When(date));

  // in case you want a custom format:
  var time = When(date).toTime();
  if (time.unit == TimeUnit.YEAR) {
    // x years ago in Spanish
    print('Hace ${time.amount} aƱos')
  }
}
0
likes
90
pub points
43%
popularity

Calculates how many years, months, days, ... ago a DateTime is.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

yourd3veloper@gmail.com

License

BSD (LICENSE)

More

Packages that depend on whenwas