fix(newsletter): use US timezones for Sunday delivery guard #77

Merged
addison merged 2 commits from exe-dev-bot/market:fix/sunday-guard-timezone into main 2026-02-12 04:33:30 -05:00
Contributor

Summary

The newsletter Sunday guard was using getUTCDay() which is 5–10 hours ahead of US timezones. This caused:

  • Missed Sundays: Sunday evening US time is already Monday UTC, so newsletters were delivered on Sunday
  • Blocked Saturdays: Saturday evening US time is already Sunday UTC, so delivery was incorrectly skipped

Changes

  • Replace getUTCDay() with Intl.DateTimeFormat checks against both US timezone boundaries:
    • America/New_York — earliest to enter Sunday
    • Pacific/Honolulu — latest to leave Sunday
    • If it's Sunday in either, delivery is skipped
  • Expand cron schedule from MON-SAT to * (every day) since the code-level guard now handles Sunday detection correctly

Testing

  • Verify isSundayInUS() returns true when it's Sunday in New York but not Honolulu (and vice versa)
  • Verify delivery proceeds normally on non-Sunday days
  • Type check passes with zero errors
## Summary The newsletter Sunday guard was using `getUTCDay()` which is 5–10 hours ahead of US timezones. This caused: - **Missed Sundays**: Sunday evening US time is already Monday UTC, so newsletters were delivered on Sunday - **Blocked Saturdays**: Saturday evening US time is already Sunday UTC, so delivery was incorrectly skipped ## Changes - Replace `getUTCDay()` with `Intl.DateTimeFormat` checks against both US timezone boundaries: - `America/New_York` — earliest to enter Sunday - `Pacific/Honolulu` — latest to leave Sunday - If it's Sunday in **either**, delivery is skipped - Expand cron schedule from `MON-SAT` to `*` (every day) since the code-level guard now handles Sunday detection correctly ## Testing - [ ] Verify `isSundayInUS()` returns `true` when it's Sunday in New York but not Honolulu (and vice versa) - [ ] Verify delivery proceeds normally on non-Sunday days - [ ] Type check passes with zero errors
The Sunday guard was using getUTCDay() which is 5-6 hours ahead of US
time zones. This caused the guard to miss actual US Sundays (Sunday
evening US = Monday UTC) and incorrectly block Saturday evenings
(Saturday evening US = Sunday UTC).

Now uses Intl.DateTimeFormat with America/Chicago (Central Time) which
is supported in Cloudflare Workers and aligns with actual US Sundays.

Co-authored-by: Shelley <shelley@exe.dev>
fix(newsletter): check all US timezones for Sunday guard, run cron daily
Some checks failed
CI / Lint, Type Check, Format & Unit Tests (pull_request) Successful in 1m46s
CI / E2E Tests (pull_request) Failing after 2m45s
69d8145bf1
Check both America/New_York (earliest to enter Sunday) and
Pacific/Honolulu (latest to leave Sunday) so delivery is skipped
whenever it's Sunday in any US timezone.

Expand cron from MON-SAT to every day since the code-level guard
now handles Sunday detection correctly for US timezones.

Co-authored-by: Shelley <shelley@exe.dev>
addison deleted branch fix/sunday-guard-timezone 2026-02-12 04:33:30 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kwila/market!77
No description provided.