feat(data): normalize timestamp and timezone storage rules (#71)#751
Merged
Calebux merged 2 commits intoMay 28, 2026
Merged
Conversation
- Fix QuietHoursService to evaluate quiet hours in the user's IANA timezone (quiet_hours_timezone) instead of raw UTC. Previously the stored timezone was ignored entirely, causing wrong quiet-hours windows for all non-UTC users. - Fix getQuietHoursEndTime: replace setHours() (which used the server's system timezone) with a date-string approach via fromZonedTime, making the calculation fully system-timezone-independent. - Fix isAppropriateTimeForDelayedNotifications: 08:00-22:00 window now evaluated in the user's local timezone, not UTC. - Add resolveTimezone() helper with graceful fallback to UTC for empty or unrecognised IANA identifiers. - Add date-fns-tz@3.2.0 as a backend dependency for timezone-aware date arithmetic. - Fix pre-existing Jest blocker: uuid v14 (ESM) was preventing all quiet-hours tests from running. Added uuid to transformIgnorePatterns and a .js transform rule. - Add docs/timestamp-timezone-rules.md: canonical reference documenting storage rules for all timestamp/timezone columns across all affected tables, DST edge cases, and implementation guidance. - Add supabase migration 20260528000000: COMMENT ON COLUMN statements for every timestamp/timezone column in user_preferences, subscriptions, reminder_schedules, notification_deliveries, and delayed_notifications. - Add JSDoc to UserPreferences type documenting storage rules. - Remove duplicate fields from Subscription type in reminder.ts. - Add backend/tests/timestamp-timezone.test.ts: 27 new tests covering non-UTC timezones (EST, JST), DST spring-forward/fall-back, overnight and same-day quiet windows, timezone fallback, and correct UTC output from getQuietHoursEndTime. All 76 tests pass across 5 suites.
|
@od-hunter Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #665
#665