whenwas 1.1.0 copy "whenwas: ^1.1.0" to clipboard
whenwas: ^1.1.0 copied to clipboard

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
40
pub points
0%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

BSD-2-Clause (LICENSE)

More

Packages that depend on whenwas