Function formatTimeSpan

  • Get a localized string representation of the time between two dates

    Parameters

    • relativeTimeFormatter: RelativeTimeFormat
    • since: Date

      "Destination" time. time against which to get the time span.

    • to: Date = ...

      "Starting" time. Time span will be formatted relative to to. Defaults to new Date()

    Returns string

    Time span in words from to to since

    `since` = 3 Aug 2024 8:00 AM

    `to` = 5 Aug 2024 8:000 AM

    Returns: "two days ago"