timeago method

String timeago({
  1. String? locale,
  2. DateTime? clock,
  3. bool? allowFromNow,
})

Formats provided date to a fuzzy time like 'a moment ago' (use timeago package to change locales)

  • If locale is passed will look for message for that locale, if you want to add or override locales use setLocaleMessages. Defaults to 'en'
  • If clock is passed this will be the point of reference for calculating the elapsed time. Defaults to DateTime.now()
  • If allowFromNow is passed, format will use the From prefix, ie. a date 5 minutes from now in 'en' locale will display as '5 minutes from now' If locales was not loaded previously en would be used use timeago.setLocaleMessages to set them

Implementation

String timeago({String? locale, DateTime? clock, bool? allowFromNow}) =>
    timeago_lib.format(
      this,
      locale: locale,
      clock: clock,
      allowFromNow: allowFromNow ?? false,
    );