[FEAT] : add Timezone-Aware Weekly Digest (Aesthetics & UX) - #3000
hrshjswniii wants to merge 5 commits into
Conversation
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
|
Hiii @Priyanshu-byte-coder , do review the issue implemented and feel free to merge the Pr !! |
|
New feature/UI PRs are on hold during the code-quality sprint — see discussion #2651. We'll revisit this after the sprint; meanwhile tests, refactors, and bug-fix PRs are very welcome. |
|
Conflicts with |
Summary
Updates the weekly digest email cron job to deliver digests at Monday 09:00 AM in the user's local timezone instead of a single global UTC slot. It shifts the cron run schedule from once-weekly to hourly, matches users dynamically, and fixes a non-deterministic pagination bug in the users table database query.
Closes #2982
Type of Change
What Changed
/api/cron/weekly-digestfrom once-weekly (0 9 * * 1) to hourly (0 * * * *).isUserLocalTimeTargetRangehelper usingIntl.DateTimeFormatto resolve local hours and weekdays for users.currentWeekLabelInTimezoneto compute week labels matching the local Monday date. This resolves skew errors in eastern timezones (e.g. Sydney, Tokyo) where Sunday UTC is already Monday local..order("id")instruction before the.range()block to ensure deterministic database query paging.skippedTimezoneCountproperty.How to Test
America/New_YorkorAsia/Kolkata).Authorizationheader).skipped_timezonefor that user and that the return payload incrementsskippedTimezoneCount.Expected result: Users only receive digests at Monday 9 AM local time, and week label dates are calculated correctly based on local offsets.
Checklist
console.log, debug code, or commented-out blocksnpm run lintpasses locallynpm run type-check)Accessibility (UI changes only)
N/A - Backend / configuration change.
Additional Context
The idempotency guard cooldown (
DIGEST_COOLDOWN_MS = 6 days) is preserved, guaranteeing that even if a user switches timezones or crons overlap, they will never receive duplicate digest emails in the same week.