Repository navigation
fix(test): build test dates in local time - #13430
Merged
Merged
Conversation
This was referenced Sep 25, 2026
Three tests built a date in UTC and the code under test read it back in the local zone, so they passed only where the two agree on the calendar day, as in CI (UTC): - the 2 past-deadline tests set the Deadline to UTC midnight, which west of UTC is the previous local day, so the journal ref went to the wrong page. The date picker stores local midnight; the tests now do the same with int->local-date. - the reschedule journal-template test fixed now at 12:00 UTC, which east of UTC+12 is already the next local day, so the next occurrence landed 1 day after the expected page. It now uses local noon. Reproduce with TZ=Etc/GMT+12 and TZ=Pacific/Kiritimati.
tiensonqin
force-pushed
the
fix/tz-dependent-tests
branch
from
September 26, 2026 12:44
07d8adb to
fd13d6d
Compare
This was referenced Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Three tests pass only when the machine's time zone agrees with UTC on the calendar day. CI runs in UTC, so they pass there; west of UTC (the Americas) or east of UTC+12 they fail. This builds their dates in local time. Test code only.
Mechanism
A Deadline or Scheduled value is a millisecond timestamp, and the code reads its day in the local zone (
date-time-util/ms->journal-daygoes throught/to-default-time-zone). The date picker writes local midnight (calendar-inner,.setHours d 0 0 0), so the app writes and reads in the same zone.clearing-past-deadline-drops-journal-ref-from-rebuild(logseq.outliner.date-property-test) andclearing-past-deadline-removes-journal-linked-ref-test(frontend.worker.pipeline-test), added in fix: drop stale journal refs when clearing datetime values #13417, build the Deadline withdate-time-util/journal-day->ms, which gives midnight UTC. West of UTC that instant is the evening before, so the journal ref goes to the previous day's page and the assertions that expect the past journal fail. They now use(.getTime (date-time-util/int->local-date day)), local midnight, as the picker does.journal-tag-template-applied-on-repeating-task-reschedule-test(frontend.worker.pipeline-test) fixes now at(t/date-time 2026 9 20 12 0 0), 12:00 UTC. From UTC+12 eastward that is already the 21st locally, so the next occurrence 6 days later falls on the 27th and the test finds no page for the 26th. It now usest/local-date-time, local noon, which is the 20th in every zone.Tests
The 2 namespaces, run with
TZ=Etc/GMT+12andTZ=Pacific/Kiritimati(UTC-12 and UTC+14):The branch also passes both namespaces in
America/Los_AngelesandUTC. The whole unit suite in both zones on this branch: 2476 tests, 12407 assertions, 0 failures, 0 errors in each.Between them UTC-12 and UTC+14 are on a different calendar day from UTC at every hour, so running the suite once in each catches a test of this kind whenever it runs.
Allow edits from maintainers.