Skip to content

Relative time
@localizer/format-relativetime 1.0.1

relativeTimeFormatter<T> ( options? ): RelativeValueFormatter<T>

  • T extends number | Date - The type of value to format. Number values are treated as timestamps (milliseconds since January 1, 1970, 00:00:00 UTC).
  • options - Optional configuration of the formatter.

This formatter provides a flexible, locale-aware way to display relative times for past and future events.

TIP

If you prefer to use default settings, consider using a preconfigured relative time formatter. It simplifies the process by providing a ready-to-use configuration for common use cases.