fromNow method
Returns a String
with the different between this and Moment.now(). Takes an optional
bool
argument to decide whether to use an identifier. withoutPrefixOrSuffix
defaults
to false
.
var berlinWallFell = Moment.parse('19891109');
// Assuming Moment.now() is in 2018
String difference = berlinWallFell.fromNow();
assert(difference == 'in 29 years');
var berlinWallFell = Moment.parse('19891109');
// Assuming Moment.now() is in 2018
String difference = berlinWallFell.fromNow(false);
assert(difference == '29 years');
Implementation
String fromNow([bool withoutPrefixOrSuffix = false]) {
return from(new Moment(), withoutPrefixOrSuffix);
}