• Format a simple ISO 8601 duration to plain English.

    This works for non-composite durations, i.e. that have a single unit with associated amount. For example: "P1Y" or "P3W".

    See https://en.wikipedia.org/wiki/ISO_8601#Durations

    This method is provided as a utility for getting simple things done quickly. In your application, you'll probably need some other method that supports multiple locales.

    Parameters

    • Optional iso: string

      Duration formatted in IS0 8601

    • Optional options: {
          omitOne?: boolean;
      }
      • Optional omitOne?: boolean

    Returns string

    The duration in plain english. Example: "1 year" or "3 weeks".