@@ -528,28 +528,31 @@ public function generateDatesByType($type, $startEvent, $endEvent, $repeatUntilD
528528 break ;
529529 }
530530
531- // @todo remove comment code
532- $ startDateInLocal = new DateTime ($ newStartDate , new DateTimeZone ($ timeZone ));
531+ // @todo remove comment code
532+ // The code below was not adpating to saving light time but was doubling the difference with UTC time.
533+ // Might be necessary to adapt to update saving light time difference.
534+ /* $startDateInLocal = new DateTime($newStartDate, new DateTimeZone($timeZone));
533535 if ($startDateInLocal->format('I') == 0) {
534536 // Is saving time? Then fix UTC time to add time
535537 $seconds = $startDateInLocal->getOffset();
536538 $startDate->add(new DateInterval("PT".$seconds."S"));
537539 //$startDateFixed = $startDate->format('Y-m-d H:i:s');
538- /* $startDateInLocalFixed = new DateTime($startDateFixed, new DateTimeZone($timeZone));
539- $newStartDate = $startDateInLocalFixed->format('Y-m-d H:i:s');*/
540+ // $startDateInLocalFixed = new DateTime($startDateFixed, new DateTimeZone($timeZone));
541+ // $newStartDate = $startDateInLocalFixed->format('Y-m-d H:i:s');
540542 //$newStartDate = $startDate->setTimezone(new DateTimeZone($timeZone))->format('Y-m-d H:i:s');
541543 }
542- $ newStartDate = $ startDate ->setTimezone (new DateTimeZone ($ timeZone ))->format ('Y-m-d H:i:s ' );
543- $ endDateInLocal = new DateTime ($ newEndDate , new DateTimeZone ($ timeZone ));
544544
545+ $endDateInLocal = new DateTime($newEndDate, new DateTimeZone($timeZone));
545546 if ($endDateInLocal->format('I') == 0) {
546547 // Is saving time? Then fix UTC time to add time
547548 $seconds = $endDateInLocal->getOffset();
548549 $endDate->add(new DateInterval("PT".$seconds."S"));
549550 //$endDateFixed = $endDate->format('Y-m-d H:i:s');
550551 //$endDateInLocalFixed = new DateTime($endDateFixed, new DateTimeZone($timeZone));
551552 //$newEndDate = $endDateInLocalFixed->format('Y-m-d H:i:s');
552- }
553+ }
554+ */
555+ $ newStartDate = $ startDate ->setTimezone (new DateTimeZone ($ timeZone ))->format ('Y-m-d H:i:s ' );
553556 $ newEndDate = $ endDate ->setTimezone (new DateTimeZone ($ timeZone ))->format ('Y-m-d H:i:s ' );
554557 $ list [] = ['start ' => $ newStartDate , 'end ' => $ newEndDate ];
555558 $ counter ++;
0 commit comments