Commit a525e8c1cd9bc6ee1d774750ce6573826d16c4a7

Authored by Nathanaël Jourdane
1 parent eefe1e26

import tt: Substract one day on DOY dates

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
php/classes/TimeTableMgr.php
... ... @@ -342,8 +342,10 @@ class TimeTableMgr extends AmdaObjectMgr
342 342 $doyRegex = '(\d{4}) (\d{2,3}) (\d{2}) (\d{2}) (\d{2})( \d{2})?';
343 343  
344 344 if (preg_match('/^' . $doyRegex . ' ' . $doyRegex . '$/', $line)) {
345   - $startDate = DateTime::createFromFormat($doyFormat, substr($line, 0, 17))->format($isoFormat);
346   - $stopDate = DateTime::createFromFormat($doyFormat, substr($line, 18))->format($isoFormat);
  345 + $start = DateTime::createFromFormat($doyFormat, substr($line, 0, 17));
  346 + $stop = DateTime::createFromFormat($doyFormat, substr($line, 18));
  347 + $startDate = $start->sub(new DateInterval('P1D'))->format($isoFormat);
  348 + $stopDate = $stop->sub(new DateInterval('P1D'))->format($isoFormat);
347 349 } else {
348 350 $dateLength = round((strlen($line)-1) / 2);
349 351  
... ...