Skip to content

Fix day‑1 timezone bug and corresponding heatmap rendering alignment#128

Open
ctbfl wants to merge 2 commits intovran-dev:masterfrom
ctbfl:master
Open

Fix day‑1 timezone bug and corresponding heatmap rendering alignment#128
ctbfl wants to merge 2 commits intovran-dev:masterfrom
ctbfl:master

Conversation

@ctbfl
Copy link

@ctbfl ctbfl commented Jan 4, 2026

Summary

This PR resolves the day‑1 issue in the contribution graph and then fixes the remaining rendering alignment problems in the weekly/monthly/yearly views.

Approach

  1. Found the day‑1 bug and fixed it at the utility layer.
  2. After that, rendering was still misaligned, so a second round of fixes targeted the render logic.

Root cause

  • Date inputs (especially YYYY‑MM‑DD strings and UTC‑midnight values) were interpreted in local time and could shift to the previous day.
  • Some render paths re‑parsed ISO strings with new Date(...), which re‑introduced offsets and broke alignment.

Fixes

  • parseDate now treats pure YYYY‑MM‑DD as local midnight using new Date(y, m-1, d).
  • Other strings still use new Date(...).
  • generateByData uses parseDate to normalize incoming data.
  • Fix the rendering part accordingly.

Files touched

  • src/util/dateUtils.ts
  • src/render/matrixDataGenerator.ts
  • src/render/monthTrackGraphRender.ts
  • src/render/gitStyleTrackGraphRender.ts
  • src/render/graphRender.ts

Testing

  • Manual verification on local machine:
    • Weekly, monthly, and yearly views all render correctly with no day‑1 shift.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant