fromNow method
Returns a string representation of current Jiffy's instance relative
from current date and time, with optional withPrefixAndSuffix
flag
to include prefix and suffix like "in" or "ago".
Example:
final jiffy = Jiffy.parseFromDateTime(DateTime(2023, 1, 1));
print(jiffy.fromNow());
// output: a month ago
Example without returning prefix and suffix:
final jiffy = Jiffy.parseFromDateTime(DateTime(2023, 1, 1));
print(jiffy.fromNow(withPrefixAndSuffix: false));
// output: a month
If withPrefixAndSuffix
is true
(default), the output string will
include prefix and suffix words like "in" or "ago". Otherwise, only
the relative time difference string will be returned.
Implementation
String fromNow({bool withPrefixAndSuffix = true}) =>
from(Jiffy.now(), withPrefixAndSuffix: withPrefixAndSuffix);