fromNow method
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(false);
assert(difference == '29 years');
Implementation
String fromNow([bool withoutPrefixOrSuffix = false]) {
return from(new Tempus(), withoutPrefixOrSuffix);
}