[lexical-playground] Bug Fix: Keep all-day dates on the same day in every time zone #9930
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
potatowagon
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 showsMon Nov 16 2026 10:00.dateTimenow stores an all-day date as just the calendar date (2026-11-17), the same shape Google Calendar'sdateand iCalVALUE=DATEuse, and a timed chip keeps its ISO instant. The toolbar and the four/dateoptions insert all-day dates (INSERT_DATETIME_COMMANDtakes an optionalallDay). The text, the HTML attribute and the stored value come from the calendar fields without going through aDate, so the day is the same everywhere, including a day the local zone skipped (2011-12-30in Pacific/Apia).getDateTime()still returns aDate(local midnight for an all-day date),setDateTime()still takes one, andisAllDay()/setAllDayDate()/$createDateTimeNodeFromValue()are new.Existing documents only contain
…Zinstants, 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-fnsis 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
TZset, 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
mainstores for today inserted in Seoul, opened in a Seoul tab and a New York tab (ChromiumtimezoneId):The new tests use the new node API, so they do not run against
mainas 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', andRangeError: Invalid time valuefor an empty value), every zone in the time zone test (New YorkTue Nov 03 2026 19:00), and 12 of the 14 first picker tests against the old component.After
DateTimeNodeTimeZone.test.tsruns the node in child processes withTZset 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 withTZ=America/New_York,Asia/SeoulandPacific/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:
Same check as Before, on this branch: