Commit c18b254 1 parent 1b05f29 commit c18b254 Copy full SHA for c18b254
File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -60,11 +60,14 @@ export function assertValidDateTimeFormat(
60
60
* @returns An equivalent minimal set of Intervals without any intersections.
61
61
*/
62
62
export function mergeIntersecting ( input : Interval < true > [ ] ) : Interval < true > [ ] {
63
+ input . forEach ( ( interval ) => assertValidLuxonValue ( interval ) ) ;
63
64
const sortedOutput : Interval < true > [ ] = [ ] ;
64
65
for ( const sortedNext of sortBy ( input , [ "start" , "end" ] ) ) {
65
66
const prevIndex = sortedOutput . length - 1 ;
66
67
if ( prevIndex >= 0 && sortedOutput [ prevIndex ] . intersection ( sortedNext ) ) {
67
- sortedOutput [ prevIndex ] = sortedOutput [ prevIndex ] . union ( sortedNext ) as Interval < true > ;
68
+ const union = sortedOutput [ prevIndex ] . union ( sortedNext ) ;
69
+ assertValidLuxonValue ( union ) ;
70
+ sortedOutput [ prevIndex ] = union ;
68
71
} else {
69
72
sortedOutput . push ( sortedNext ) ;
70
73
}
You can’t perform that action at this time.
0 commit comments