iggs-utils - v2.4.0
    Preparing search index...

    Function splitIntervalByDuration

    • divide the given interval into smaller intervals, each having the duration equal to the given duration

      Parameters

      Returns Interval[]

      const start=new Date('2000-01-01');
      const end=new Date('2000-01-10');

      splitIntervalByDuration({start, end},{days:1});
      // [
      // {start:2000-01-01, end:2000-01-02},
      // {start:2000-01-02, end:2000-01-03},
      // {start:2000-01-03, end:2000-01-04},
      // {start:2000-01-04, end:2000-01-05},
      // {start:2000-01-05, end:2000-01-06},
      // {start:2000-01-06, end:2000-01-07},
      // {start:2000-01-07, end:2000-01-08},
      // {start:2000-01-08, end:2000-01-09},
      // {start:2000-01-09, end:2000-01-10},
      // ]