Fixed Febr. / March date handling

master
gitea 11 months ago
parent 89bc275c72
commit 3aa020efbb
  1. 11
      gen_vor.php

@ -33,11 +33,18 @@ $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);

Loading…
Cancel
Save