@@ -181,7 +181,7 @@ const CalendarFetcherUtils = {
181181 Log . debug ( `end:: ${ endMoment . toDate ( ) } ` ) ;
182182
183183 // Calculate the duration of the event for use with recurring events.
184- let durationMs = endMoment . valueOf ( ) - startMoment . valueOf ( ) ;
184+ const durationMs = endMoment . valueOf ( ) - startMoment . valueOf ( ) ;
185185 Log . debug ( `duration: ${ durationMs } ` ) ;
186186
187187 // FIXME: Since the parsed json object from node-ical comes with time information
@@ -358,6 +358,7 @@ const CalendarFetcherUtils = {
358358 for ( let d in dates ) {
359359 let date = dates [ d ] ;
360360 let curEvent = event ;
361+ let curDurationMs = durationMs ;
361362 let showRecurrence = true ;
362363
363364 startMoment = moment ( date ) ;
@@ -374,16 +375,16 @@ const CalendarFetcherUtils = {
374375 // We found an override, so for this recurrence, use a potentially different title, start date, and duration.
375376 curEvent = curEvent . recurrences [ dateKey ] ;
376377 startMoment = moment ( curEvent . start ) ;
377- durationMs = curEvent . end . valueOf ( ) - startMoment . valueOf ( ) ;
378+ curDurationMs = curEvent . end . valueOf ( ) - startMoment . valueOf ( ) ;
378379 }
379380 // If there's no recurrence override, check for an exception date. Exception dates represent exceptions to the rule.
380381 else if ( curEvent . exdate !== undefined && curEvent . exdate [ dateKey ] !== undefined ) {
381382 // This date is an exception date, which means we should skip it in the recurrence pattern.
382383 showRecurrence = false ;
383384 }
384- Log . debug ( `duration: ${ durationMs } ` ) ;
385+ Log . debug ( `duration: ${ curDurationMs } ` ) ;
385386
386- endMoment = moment ( startMoment . valueOf ( ) + durationMs ) ;
387+ endMoment = moment ( startMoment . valueOf ( ) + curDurationMs ) ;
387388 if ( startMoment . valueOf ( ) === endMoment . valueOf ( ) ) {
388389 endMoment = endMoment . endOf ( "day" ) ;
389390 }
0 commit comments