[FEAT] : add Timezone-Aware Weekly Digest (Aesthetics & UX) #3000
Open
hrshjswniii wants to merge 5 commits into
Open
[FEAT] : add Timezone-Aware Weekly Digest (Aesthetics & UX) #3000hrshjswniii wants to merge 5 commits into
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):
|
Contributor
Author
|
Hiii @Priyanshu-byte-coder , do review the issue implemented and feel free to merge the Pr !! |
Owner
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.