From 3aa020efbb1a3dbcaec8497cbe495fbdb97944c9 Mon Sep 17 00:00:00 2001 From: gitea Date: Fri, 31 May 2024 06:03:28 +0200 Subject: [PATCH] Fixed Febr. / March date handling --- gen_vor.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gen_vor.php b/gen_vor.php index 75db4dc..e6c83d7 100644 --- a/gen_vor.php +++ b/gen_vor.php @@ -33,16 +33,23 @@ $tues_date = (new DateTime())->setTimeStamp($tues_ts); const JUST_DATE = 'Ymd'; +# Check for February / March +$month = $first_day->format('n'); +$cond = true; +if ($month == 2 || $month == 3) { + $cond = $first_day->format(JUST_DATE) != $first_wedn->format(JUST_DATE) && $tues_date->format('md') != '0322'; +} + // Are we past the fourth Tuesday of this month? -if ((new DateTime())->getTimeStamp() >= $tues_ts && $first_day->format(JUST_DATE) != $first_wedn->format(JUST_DATE) && $tues_date->format('md') != '0322') { +if ((new DateTime())->getTimeStamp() >= $tues_ts && $cond) { $ts = strtotime('+1 month', $ts); /* - var_dump($tues_date->format('md')); + var_dump($tues_date->format('md')); var_dump($first_day); var_dump($first_wedn); var_dump($ts); */ -} +} foreach ($fil as $line) { // Skip empty lines