From a525e8c1cd9bc6ee1d774750ce6573826d16c4a7 Mon Sep 17 00:00:00 2001 From: Nathanaƫl Jourdane Date: Mon, 25 Jun 2018 11:46:59 +0200 Subject: [PATCH] import tt: Substract one day on DOY dates --- php/classes/TimeTableMgr.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/php/classes/TimeTableMgr.php b/php/classes/TimeTableMgr.php index 181cc7b..4244f65 100644 --- a/php/classes/TimeTableMgr.php +++ b/php/classes/TimeTableMgr.php @@ -342,8 +342,10 @@ class TimeTableMgr extends AmdaObjectMgr $doyRegex = '(\d{4}) (\d{2,3}) (\d{2}) (\d{2}) (\d{2})( \d{2})?'; if (preg_match('/^' . $doyRegex . ' ' . $doyRegex . '$/', $line)) { - $startDate = DateTime::createFromFormat($doyFormat, substr($line, 0, 17))->format($isoFormat); - $stopDate = DateTime::createFromFormat($doyFormat, substr($line, 18))->format($isoFormat); + $start = DateTime::createFromFormat($doyFormat, substr($line, 0, 17)); + $stop = DateTime::createFromFormat($doyFormat, substr($line, 18)); + $startDate = $start->sub(new DateInterval('P1D'))->format($isoFormat); + $stopDate = $stop->sub(new DateInterval('P1D'))->format($isoFormat); } else { $dateLength = round((strlen($line)-1) / 2); -- libgit2 0.21.2