fromNow method

String fromNow ([bool withoutPrefixOrSuffix = false ])

Returns a String with the different between this and Tempus(). Takes an optional bool argument to decide whether to use an identifier. withoutPrefixOrSuffix defaults to false.

var berlinWallFell = Tempus.parse('19891109');
// Assuming Tempus() is in 2018
String difference = berlinWallFell.fromNow();
assert(difference == 'in 29 years');

var berlinWallFell = Tempus.parse('19891109');
// Assuming Tempus() is in 2018
String difference = berlinWallFell.fromNow(true);
assert(difference == '29 years');

Implementation

String fromNow([bool withoutPrefixOrSuffix = false]) {
  return new Tempus().from(this, withoutPrefixOrSuffix);
}