split-interval
v1.0.7
Published
Splits a given interval across start and end times
Downloads
12
Readme
split-interval
Splits the given interval across multiple days with start and end times.
Usage
const splitInterval = require('split-interval');
splitInterval(startDate, endDate, startTime, endTime);
Arguments
startDate
- ADate
object representing the start of the interval to splitendDate
- ADate
object representing the end of the interval to splitstartTime
- AString
in the formathh:mm:ss
representing the start time of the interval segmentsendTime
- AString
in the formathh:mm:ss
representing the end of the interval segments
Example
Given the following interval 2019-06-01 12:00 PM
to 2019-06-04 12:00 PM
, with segments 8:30 AM
to 5:00 PM
, we will get the following segments as the result:
2019-06-01 12:00PM
-2019-06-01 5:00PM
2019-06-02 8:30AM
-2019-06-02 5:00PM
2019-06-03 8:30AM
-2019-06-03 5:00PM
2019-06-04 8:30AM
-2019-06-04 12:00PM