Util:Time

Source: time.ts:6

Time formatting utilities


Instance Methods

toTimeAgo( date: string | Date | null, locale?: string, ): string | null

Turn a date into a "time ago" string, e.g. "5 minutes ago", "2 days ago"

Parameters

  • date (string | Date | null) — Date to format
  • locale (string, optional) — Locale to use for formatting (defaults to current i18n locale)

Returns

  • string | null — Formatted time ago string or null if date is null