Skip to content

Bump server/shared: pin MySQL connection to UTC - #166

Merged
buzz-code merged 1 commit into
mainfrom
claude/teachers-attendance-timezone-fge29w
Sep 1, 2026
Merged

buzz-code merged 1 commit into
mainfrom
claude/teachers-attendance-timezone-fge29w

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Summary

Reported hours on the "teachers who reported attendance" screen could show a wrong time — e.g. a report made at 10:24 Israel time showing as 13:24.

Root cause

Confirmed in nra-server's TypeORM MySQL DataSourceOptions: no explicit timezone was set, so mysql2 defaulted to timezone: 'local'. For timestamp/datetime-typed columns (like AttReport.createdAt, which reportHour is derived from), TypeORM hands mysql2 a raw JS Date object; under 'local', mysql2 serializes/parses it using the Node process's local getters (getHours()) instead of UTC getters (getUTCHours()). If the server process's local timezone isn't UTC, a Date representing the correct absolute instant gets written using local wall-clock digits, which MySQL then stores as if already UTC — a silent hour shift.

Change

Bumps server/shared to pick up buzz-code/nra-server#44, which pins timezone: 'Z' on the mysql connection so writes/reads always go through UTC, independent of the server process's local timezone.

Scope

Fixes new writes going forward — does not backfill already-stored (already-shifted) historical created_at/updated_at values.

Testing

  • cd server && yarn build — clean

🤖 Generated with Claude Code


Generated by Claude Code

Picks up buzz-code/nra-server#44, which fixes a timestamp
double-conversion bug: mysql2 defaulted to timezone:'local', so
attReport.createdAt (used for teacher_reported_today's reportHour)
could be stored using the server process's local wall-clock digits
and then read back as if they were UTC — a silent hour shift whenever
the server's local timezone isn't UTC.
Copilot AI lite review requested due to automatic review settings September 1, 2026 12:19

Copilot AI 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.

🟢 Approval recommended

Change is isolated submodule pointer bump to single upstream config fix with low blast radius.

Pull request overview

Bump server/shared git submodule to pull in buzz-code/nra-server change that pins MySQL connection timezone: 'Z' (UTC), preventing Date round-trip hour shifts when server process timezone not UTC.

Changes:

  • Update server/shared submodule pointer from 251c30ce… to 6bcdbcb4…
  • Pick up upstream nra-server change adding timezone: 'Z' to TypeORM MySQL DataSourceOptions
File summaries
File Description
server/shared Submodule bump to nra-server commit 6bcdbcb4… adding MySQL UTC timezone pin
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants