Function formatDurationInUnits

  • Formats the duration between two dates in the specified number of units

    Parameters

    Returns string

    A string representing the duration between the start and end date in the specified number of units

    Example

    formatDurationInUnits('2021-01-01', '2021-01-02', { numberOfUnits: 2 });
    // => '1 day'

    formatDurationInUnits('2021-01-01', '2021-02-02', { numberOfUnits: 2, delimiter: ', ' });
    // => '1 month, 1 day'

Generated using TypeDoc