Function range

  • Returns an array of dates representing every interval boundary after or equal to start (inclusive) and before stop (exclusive).

    If step is specified, then every step-th boundary will be returned; for example, for the timeDay interval a step of 2 will return every other day. If step is not an integer, it is floored.

    The first date in the returned array is the earliest boundary after or equal to start; subsequent dates are offset by step intervals and floored. Thus, two overlapping ranges may be inconsistent.

    To make ranges consistent when a step is specified, use CountableInterval.every instead.

    Parameters

    • start: Date

      A start date object for the range.

    • stop: Date

      A stop date object for the range.

    • Optional step: number

      An optional number of steps to apply when calculating the dates in the range.

    Returns Date[]