Browse Source

corrige le calcul des dates adjacentes

master
vince vince 3 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;
}
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);
}
@ -175,12 +175,12 @@ if (!$isConfig and $hasSupplier) {
$start = new \DateTime($config[$supplier]['start']);
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');
header('Location: ' . generateUrl($supplier, $nextEvent));
die();
} else {
$current = new \DateTimeImmutable($event);
$current = new \DateTime($event);
$previous = findPrevious($current, $config[$supplier]['frequency'], $config[$supplier]['excludes'], false);
$previousEvent = $previous->format('Y-m-d');
if (false and !array_key_exists($previousEvent, $data[$supplier]))


Loading…
Cancel
Save