Why this matters now: isNowInQuietHours() (line 11) computes now.getUTCHours() * 60 + now.getUTCMinutes() but the user-configured quiet hours (e.g., '22:00' to '07:00') are clearly local times. For a user in Nairobi (UTC+3) who sets quiet hours 22:00-07:00, the function evaluates against UTC, so notifications at 01:00 EAT (22:00 UTC) would be incorrectly suppressed, while notifications at 04:00 EAT (01:00 UTC) would incorrectly fire.
Problem / What: src/utils/quietHours.ts:11 — const nowMin = now.getUTCHours() * 60 + now.getUTCMinutes(). This should use now.getHours() and now.getMinutes() for local time.
Key Challenges:
- Change
getUTCHours() / getUTCMinutes() to getHours() / getMinutes().
- Update the existing
quietHours.test.ts (if any) to test with timezone offsets.
- The
dayKey function in streaks.ts uses local time (getFullYear/getMonth/getDate), which is correct — this inconsistency with quietHours.ts was likely an oversight.
- Consider: should quiet hours be stored as UTC offsets or local time strings? The current approach (local time strings) is more user-friendly.
Acceptance Criteria:
isNowInQuietHours uses local time (getHours()/getMinutes()).
- Tests verify correct behavior for UTC+0, UTC+3, UTC-5 timezones.
- Quiet hours 22:00-07:00 correctly suppresses notifications at midnight local time in all timezones.
- No other time-related functions use UTC inconsistently.
Relevant files/functions:
src/utils/quietHours.ts:11
src/__tests__/ (quietHours test, update or create)
Out of scope: Timezone-aware DST handling.
Labels: bug, intermediate, notifications
Why this matters now:
isNowInQuietHours()(line 11) computesnow.getUTCHours() * 60 + now.getUTCMinutes()but the user-configured quiet hours (e.g.,'22:00'to'07:00') are clearly local times. For a user in Nairobi (UTC+3) who sets quiet hours 22:00-07:00, the function evaluates against UTC, so notifications at 01:00 EAT (22:00 UTC) would be incorrectly suppressed, while notifications at 04:00 EAT (01:00 UTC) would incorrectly fire.Problem / What:
src/utils/quietHours.ts:11—const nowMin = now.getUTCHours() * 60 + now.getUTCMinutes(). This should usenow.getHours()andnow.getMinutes()for local time.Key Challenges:
getUTCHours()/getUTCMinutes()togetHours()/getMinutes().quietHours.test.ts(if any) to test with timezone offsets.dayKeyfunction instreaks.tsuses local time (getFullYear/getMonth/getDate), which is correct — this inconsistency withquietHours.tswas likely an oversight.Acceptance Criteria:
isNowInQuietHoursuses local time (getHours()/getMinutes()).Relevant files/functions:
src/utils/quietHours.ts:11src/__tests__/(quietHours test, update or create)Out of scope: Timezone-aware DST handling.
Labels:
bug,intermediate,notifications