Tweak drive ending times

This commit is contained in:
Alex Cabal 2025-01-06 10:30:08 -06:00
parent 07836555cd
commit 343d92f7c9
2 changed files with 8 additions and 6 deletions

View file

@ -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
)

View file

@ -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 `<picture>` elements download all `<source>`s instead of the first supported match.
// So, we try to detect Safari here, and don't use multiple `<source>` if we find Safari.