Skip to content

fix(core): make day conversion deterministic#20

Open
dearlordylord wants to merge 1 commit into
hcengineering:mainfrom
dearlordylord:fix/core-timezone-day
Open

fix(core): make day conversion deterministic#20
dearlordylord wants to merge 1 commit into
hcengineering:mainfrom
dearlordylord:fix/core-timezone-day

Conversation

@dearlordylord

@dearlordylord dearlordylord commented May 28, 2026

Copy link
Copy Markdown

Minor priority. This issue popped up when I was working on #19 (I'm not in London, as you can guess! 😄 ) (although there is A London, Ontario in my timezone!)

Summary

  • Make getDay / convertToDay independent of the Node process timezone
  • Preserve the behavior already implied by the existing tests: resolve the calendar day in Europe/London, then normalize it to noon UTC
  • Add regression coverage for a case that fails when the process timezone is America/Los_Angeles

Notes

The previous implementation mixed local-time day reads with UTC writes, so the same timestamp could normalize to different days depending on where the tests ran. The existing tests already used Europe/London as the expected day, but they failed under non-London process timezones because the implementation depended on local Date behavior.

Test plan

  • TZ=America/Los_Angeles node common/scripts/install-run-rush.js retest --to @hcengineering/core
  • TZ=Europe/London node common/scripts/install-run-rush.js retest --to @hcengineering/core
  • node_modules/.bin/eslint src/time.ts src/__tests__/time.test.ts
  • node_modules/.bin/tsc --noEmit --pretty false

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