From 47a74fad13068c99067db4c20d555078c1e4d8c6 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Jul 2024 10:14:26 +0200 Subject: [PATCH] Fixed date logic --- gen_vor.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gen_vor.php b/gen_vor.php index e6c83d7..b872be7 100644 --- a/gen_vor.php +++ b/gen_vor.php @@ -30,6 +30,7 @@ if ($first_wedn->format('md') == '0301') { } $tues_ts = strtotime($number . ' tuesday of this month', $ts); $tues_date = (new DateTime())->setTimeStamp($tues_ts); +$wed_ts = strtotime('next day', $tues_ts); const JUST_DATE = 'Ymd'; @@ -38,10 +39,11 @@ $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'; + printf('Cond: %d\n', $cond); } // Are we past the fourth Tuesday of this month? -if ((new DateTime())->getTimeStamp() >= $tues_ts && $cond) { +if ((new DateTime())->getTimeStamp() >= $wed_ts && $cond) { $ts = strtotime('+1 month', $ts); /* var_dump($tues_date->format('md'));