Browse Source

corrige le calcul des dates adjacentes

master
vince vince 2 years ago
parent
commit
e4d61a65ba
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      index.php

+ 3
- 3
index.php View File

@ -63,7 +63,7 @@ function findNext($start, $frequency, $excludes = [], $vsNow = true, $maxIterati
return $current; return $current;
} }
function findPrevious($start, $frequency, $excludes = [], $nsNow = true, $maxIterations = 1000) {
function findPrevious($start, $frequency, $excludes = [], $vsNow = true, $maxIterations = 1000) {
return findNext($start, $frequency, $excludes, $vsNow, $maxIterations, -1); return findNext($start, $frequency, $excludes, $vsNow, $maxIterations, -1);
} }
@ -175,12 +175,12 @@ if (!$isConfig and $hasSupplier) {
$start = new \DateTime($config[$supplier]['start']); $start = new \DateTime($config[$supplier]['start']);
if (!$hasEvent) { if (!$hasEvent) {
$next = findNext($start, $config[$supplier]['frequency'], $config[$supplier]['excludes']);
$next = findNext($start, $config[$supplier]['frequency'], $config[$supplier]['excludes'], true);
$nextEvent = $next->format('Y-m-d'); $nextEvent = $next->format('Y-m-d');
header('Location: ' . generateUrl($supplier, $nextEvent)); header('Location: ' . generateUrl($supplier, $nextEvent));
die(); die();
} else { } else {
$current = new \DateTimeImmutable($event);
$current = new \DateTime($event);
$previous = findPrevious($current, $config[$supplier]['frequency'], $config[$supplier]['excludes'], false); $previous = findPrevious($current, $config[$supplier]['frequency'], $config[$supplier]['excludes'], false);
$previousEvent = $previous->format('Y-m-d'); $previousEvent = $previous->format('Y-m-d');
if (false and !array_key_exists($previousEvent, $data[$supplier])) if (false and !array_key_exists($previousEvent, $data[$supplier]))


Loading…
Cancel
Save