From 343d92f7c9b5f6430937f154df3787f794de2ee0 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Mon, 6 Jan 2025 10:30:08 -0600 Subject: [PATCH] Tweak drive ending times --- lib/Constants.php | 12 +++++++----- templates/Header.php | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/Constants.php b/lib/Constants.php index 12016bd7..a9e01302 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -5,9 +5,11 @@ use function Safe\define; const NOW = new DateTimeImmutable(); const LATEST_CONTINENTAL_US_TZ = new DateTimeZone('America/Juneau'); -const PD_NOW = new DateTimeImmutable('now', LATEST_CONTINENTAL_US_TZ); // This timestamp should be used for Public Domain Day calculations. +/** This timestamp should be used for Public Domain Day calculations. */ +const PD_NOW = new DateTimeImmutable('now', LATEST_CONTINENTAL_US_TZ); define('PD_YEAR', intval(PD_NOW->format('Y')) - 96); define('PD_STRING', 'January 1, ' . (PD_YEAR + 1)); +const SITE_TZ = new DateTimeZone('America/Chicago'); const SITE_STATUS_LIVE = 'live'; const SITE_STATUS_DEV = 'dev'; @@ -91,15 +93,15 @@ const DONATION_DRIVES_ENABLED = true; // **`TRUE`** to enable automatic donation const DONATION_DRIVE_DATES = [ new DonationDrive( 'Spring drive', - new DateTimeImmutable('Second Monday of May'), - new DateTimeImmutable('Second Monday of May +2 weeks'), + new DateTimeImmutable('Second Monday of May', SITE_TZ), + new DateTimeImmutable('Second Monday of May 22:00 +2 weeks', SITE_TZ), 40, 20 ), new DonationDrive( 'Holiday drive', - NOW < new DateTimeImmutable('January 7') ? new DateTimeImmutable('November 25 -1 year') : new DateTimeImmutable('November 25'), - NOW < new DateTimeImmutable('January 7') ? new DateTimeImmutable('January 7') : new DateTimeImmutable('January 7 +1 year'), + NOW < new DateTimeImmutable('January 7', SITE_TZ) ? new DateTimeImmutable('November 25 -1 year') : new DateTimeImmutable('November 25'), + NOW < new DateTimeImmutable('January 7', SITE_TZ) ? new DateTimeImmutable('January 7 22:00', SITE_TZ) : new DateTimeImmutable('January 7 22:00 +1 year', SITE_TZ), 75, 50 ) diff --git a/templates/Header.php b/templates/Header.php index 23c5f35f..2c9497e3 100644 --- a/templates/Header.php +++ b/templates/Header.php @@ -14,7 +14,7 @@ $isErrorPage = $isErrorPage ?? false; $downloadUrl = $downloadUrl ?? null; $canonicalUrl = $canonicalUrl ?? null; $css = $css ?? []; -$showPublicDomainDayBanner = PD_NOW > new DateTimeImmutable('January 1, 8:00 AM', new DateTimeZone('America/Chicago')) && PD_NOW < new DateTimeImmutable('January 14', LATEST_CONTINENTAL_US_TZ) && !(HttpInput::Bool(COOKIE, 'hide-public-domain-day-banner') ?? false); +$showPublicDomainDayBanner = PD_NOW > new DateTimeImmutable('January 1, 8:00 AM', SITE_TZ) && PD_NOW < new DateTimeImmutable('January 14', LATEST_CONTINENTAL_US_TZ) && !(HttpInput::Bool(COOKIE, 'hide-public-domain-day-banner') ?? false); // As of Sep. 2022, all versions of Safari have a bug where if the page is served as XHTML, then `` elements download all ``s instead of the first supported match. // So, we try to detect Safari here, and don't use multiple `` if we find Safari.