← Back to Pull requests

[lexical-playground] Bug Fix: Keep all-day dates on the same day in every time zone #9930

Closed
unknown closed this pull request without merging on Nov 17, 2026 02:32 UTC
View on GitHub
unknown unknown commented on Nov 16, 2026 20:36 UTC
Author

Description

An all-day date chip stores local midnight as an instant, so it moves to another day in other time zones. Inserting today (Nov 17) in Seoul stores 2026-11-16T15:00:00.000Z, and the same document in New York shows Mon Nov 16 2026 10:00.

dateTime now stores an all-day date as just the calendar date (2026-11-17), the same shape Google Calendar's date and iCal VALUE=DATE use, and a timed chip keeps its ISO instant. The toolbar and the four /date options insert all-day dates (INSERT_DATETIME_COMMAND takes an optional allDay). The text, the HTML attribute and the stored value come from the calendar fields without going through a Date, so the day is the same everywhere, including a day the local zone skipped (2011-12-30 in Pacific/Apia). getDateTime() still returns a Date (local midnight for an all-day date), setDateTime() still takes one, and isAllDay() / setAllDayDate() / $createDateTimeNodeFromValue() are new.

Existing documents only contain …Z instants, and they load, show and save exactly as before. Every other string is still read as an instant the way it was, except a date-only value from outside JSON or HTML, which is now an all-day date rather than UTC midnight. A date-only value that is not a calendar date (2026-02-30) and a missing value are dropped instead of throwing on export.

In the picker, unchecking the time makes the chip all-day, picking a day keeps it all-day unless a time is set, and a typed time makes it an instant. The picker now reads the node on every render, so undo, redo and collaborators update it.

Older builds read a date-only value as UTC midnight (the previous day west of UTC). The Collab Y schema version goes to 2 so an older tab opens such a document read only. Collab v1/v2 (@lexical/yjs) have no schema version, so a tab there still running the previous playground shows the previous day until it reloads. date-fns is removed from the playground's dependencies because nothing imports it anymore.

Changeset

None, playground only.

Test plan

Most of the bugs here only show up away from UTC, where CI runs, so the tests are heavier than usual: the node runs in child processes with TZ set, the value rules have property tests against an independent calendar, and the picker is tested as a sequence of steps with its state checked after each one. I also swept all 418 time zones locally, which turned up a 1942 midnight gap in Atlantic/Azores that the fixed zones missed, so it is in the list below.

Before

The value main stores for today inserted in Seoul, opened in a Seoul tab and a New York tab (Chromium timezoneId):

stored            "2026-11-16T15:00:00.000Z"
Asia/Seoul        Tue Nov 17 2026
America/New_York  Mon Nov 16 2026 10:00

The new tests use the new node API, so they do not run against main as is. In the order I wrote them, each failed on its assertions first: the JSON table (expected '2026-11-04T00:00:00.000Z' to be '2026-11-04', and RangeError: Invalid time value for an empty value), every zone in the time zone test (New York Tue Nov 03 2026 19:00), and 12 of the 14 first picker tests against the old component.

After

$ pnpm vitest run --project unit packages/lexical-playground/__tests__/unit/DateTime
 Test Files  6 passed (6)
      Tests  96 passed (96)

$ pnpm run test-unit
 Test Files  1008 passed | 6 skipped (1014)
      Tests  40051 passed | 423 expected fail | 174 skipped (40648)

DateTimeNodeTimeZone.test.ts runs the node in child processes with TZ set to America/New_York, Asia/Seoul, America/Santiago (midnight DST start), Pacific/Apia (skipped day) and Atlantic/Azores (a 1942 midnight gap), since a test worker cannot change its zone. I also ran the DateTime unit tests with TZ=America/New_York, Asia/Seoul and Pacific/Apia; the picker test that toggles the time on Apia's skipped day only fails without the fix in that zone.

e2e, Chromium unless noted, on a machine with a Korean locale:

$ pnpm run test-e2e-chromium
  57 skipped
  651 passed (3.1m)
DateTime / HTML / List / Tables / TextFormatting specs:
  firefox 153 passed, webkit 157 passed, collab v1 129 passed, collab v2 129 passed
Collab Y mode (Collaboration + CollabY*): 39 passed

Same check as Before, on this branch:

Asia/Seoul        Tue Nov 17 2026   (stored "2026-11-17")
America/New_York  Tue Nov 17 2026

Diff: 552 lines (+414 / -138) across 6 files Reviewer: potatowagon Review duration: 356m
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 552 lines diff across 6 files
0.48
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.378
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9930"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 48.1% (MEDIUM) · Higher = larger blast radius
48.1%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 19% · Safe to merge
19%
Repository