toNow method

String toNow({
  1. bool withPrefixAndSuffix = true,
})

Returns a string representation of current Jiffy's instance relative to 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.toNow());
// output: in a month

Example without returning prefix and suffix:

final jiffy = Jiffy.parseFromDateTime(DateTime(2023, 1, 1));
print(jiffy.toNow(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 toNow({bool withPrefixAndSuffix = true}) =>
    to(Jiffy.now(), withPrefixAndSuffix: withPrefixAndSuffix);