Skip to content
This repository was archived by the owner on Jul 15, 2026. It is now read-only.

fix: use local dates to fix timezone handling + add This Week preset - #13

Open
ahanel13 wants to merge 3 commits into
dougcooper:mainfrom
ahanel13:fix-timezone-this-week-preset
Open

ahanel13 wants to merge 3 commits into
dougcooper:mainfrom
ahanel13:fix-timezone-this-week-preset

Conversation

@ahanel13

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces all toISOString().split('T')[0] date formatting with a toLocalDate() helper that uses getFullYear()/getMonth()/getDate() — eliminating UTC-offset bugs that caused dates to shift by one day for users in UTC− timezones
  • Adds a This Week date preset (Monday through today, ISO week boundary) alongside the existing Past Week (rolling 7-day) preset
  • Updates all tests to use the same toLocalDate() helper so assertions don't fail for users in negative-offset timezones; adds a dedicated test for the new This Week preset

ahanel13 and others added 2 commits June 11, 2026 19:57
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All date comparisons were using UTC (toISOString), causing tasks to
appear missing for users in non-UTC timezones. Introduces toLocalDate()
utility and fixes getDatesInRange, getDueBounds, preset range
computation, and doneOn comparisons to all use local calendar dates.

Also adds "This Week" preset (Monday through today) and updates tests
to use local date strings consistently.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new 'This Week' date preset, adds a CLAUDE.md developer guide, and refactors date handling across the dashboard and tests to use a new toLocalDate helper to avoid timezone discrepancies. The reviewer feedback highlights several critical improvements: resolving a daylight saving time (DST) bug in due boundary calculations that relies on a fixed millisecond offset, defensively parsing dates to handle full ISO timestamps safely, preventing a potential midnight race condition during date initialization, and fixing a JavaScript date rollover bug in the month preset logic.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread sp-dashboard/index.html
Comment thread sp-dashboard/index.html Outdated
Comment thread sp-dashboard/index.html Outdated
Comment thread sp-dashboard/index.html
… condition, month rollover

- Replace fixed 86400000ms offsets with setDate(+1)/getTime()-1 for DST-safe day boundaries in getDueBounds and dateRange.forEach
- Add .split('T')[0] guards in getDatesInRange and getDueBounds to handle full ISO timestamps in date fields
- Initialize startObj from endObj to eliminate midnight race condition in preset date calculation
- Fix month preset JS Date rollover bug (e.g. Mar 31 → Mar 3) by clamping to last day of previous month
- Expose getDueBounds on window for testability; add 4 tests covering the above fixes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant