Skip to content

fix(core): PowerSearch reads a date-only value as one day in one zone, and edits it there - #9655

Merged
imdreamrunner merged 1 commit into
mainfrom
fix/powersearch-date-zone
Nov 3, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
fix/powersearch-date-zone

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

fix(core): PowerSearch reads a date-only value as one day in one zone, and edits it there

Core PowerSearch, both presentations, plus a [fix] changeset and the record's gap-note lifts. The record itself (DEC-5, FR25, the [fix] justification) lands first in its own spec pull request; this one carries the code and tests and removes the implementation-gap notes the record names. The sheet's value step reuses the popover's value editor, so it reads and writes the same day. The isDateOnly: false time-of-day editor is a separate pull request. The exported PowerSearchToken and a components Token override receive timezoneID (a new optional prop on PowerSearchTokenProps) so the default token reads the same day as the built-in one.

User impact

Anyone editing a date_absolute filter in Core PowerSearch's popover from a device west of UTC, and anyone who passes timezoneID. The token showed the device's day, the accessible label showed the day and time in timezoneID, and the editor read and wrote the UTC day, ignoring timezoneID entirely (PowerSearch.tsx never passed it to the popover). In Los Angeles a filter stored as UTC midnight March 9 showed "Mar 8" on its token and opened on March 9 in the editor; a filter at March 9, 7 PM Pacific with timezoneID="America/Los_Angeles" showed "Mar 9" and opened on March 10; re-picking the day the token showed stored the previous UTC midnight, so the token then read a day earlier again.

Problem and solution fit

Why does it occur? Three readers of one unixSeconds, three zones: the token used Intl.DateTimeFormat with no timeZone (device zone), formatFilterValue used timezoneID, and the editor used toISOString().split('T')[0] and new Date('YYYY-MM-DD') (UTC). timezoneID was threaded to the label only.

Why does it harm the task? A filter that reads as one day on its token and another in its editor cannot be trusted or corrected: every "correction" moves it.

Why does that harm matter? timezoneID is documented as the zone dates format in. The released behavior did not honor it in the editor, and the record listed the disagreement as a known gap waiting on an owner decision — which the owner has now made (DEC-5).

Fix: one module, powerSearchDateZone.ts, names the zone (timezoneID; else UTC for a calendar day, the viewer's zone for an instant) and converts between an instant and a day or a wall-clock time there with the existing plainDate helpers. formatDateAbsolute is the one formatter for the token text and the label; PowerSearch.tsx passes timezoneID to the popover (and to a components Editor override; PowerSearchFilterEditor forwards it), which threads it to the value editor and the nested editor's sub-filter editors; DateAbsoluteEditor reads and writes the day in that zone; DateRangeEditor reads and writes its parts as days in that zone.

Expected behavior and authority

  • component:PowerSearch DEC-5 (this PR, decider imdreamrunner, 2026-11-02): a date_absolute and each absolute range part is a calendar day in timezoneID, else the UTC day; token, label, announcements, rows and editor read that one day; a picked day stores as that zone's midnight. FR25 states it; the known gap on date-only days is resolved into it. The isDateOnly: false open question stays open here and is decided in its own pull request.
  • timezoneID prop docs ("for date formatting").
  • spec:AST-017/FR5: a correction that restores a documented contract. Classified [fix] pending the owner's call (see Changeset category); the compatibility section of the record and the changeset state the one observable change for a caller that passes timezoneID (the stored instant is that zone's midnight, not UTC midnight). With timezoneID unset, no stored value changes.

Smallest restoration

One new module (powerSearchDateZone.ts, Core-internal, imported by relative path); one formatter signature; timezoneID threaded through the popover's existing prop chain, to the sheet's rows and value step, and to the components Token and Editor overrides, the exported PowerSearchToken and PowerSearchFilterEditor; two editors. One optional prop added to PowerSearchTokenProps (timezoneID), no visual change beyond the token showing the right day, no catalog key. timezoneID="" reads as unset, as the formatter always did.

Evidence

  • Reproduction before the change (real PowerSearch, jsdom, host zones UTC / Los Angeles / Tokyo / Honolulu × timezoneID LA / unset, instant 2024-03-10T03:00Z): token "Mar 9" in LA and Honolulu, "Mar 10" in UTC and Tokyo, in every timezoneID case; editor "March 10, 2024" in every case; picking 03/09/2024 stored 2024-03-09T00:00Z in every case; range editor in LA opened on "Mar 10 – Mar 11" for instants on the evenings of March 9 and 10 Pacific.
  • Result after the change: with timezoneID="America/Los_Angeles" token "Mar 9, 2024" and editor "March 9, 2024" under every host zone; with timezoneID="Asia/Tokyo" "Mar 10" on both; with no timezoneID a UTC-midnight value reads "Mar 9" on both under every host zone; picking March 11 stores 07:00Z (LA, daylight time), 15:00Z the day before (Tokyo), 10:00Z (Honolulu), 00:00Z (UTC and unset); a round trip in LA that moves the day to March 12 and back keeps the instant and the token; range parts "Mar 9 – Mar 10" in timezoneID, UTC days when unset.
  • Representative unchanged path: the PowerSearch, edit-popover, value-editor and formatter suites pass unchanged except for the formatter test's updated signature; Table's filter bridge (useTableFiltering) is untouched and its suite passes.
  • Regression test or other mutation-sensitive proof: PowerSearchDateZone.test.tsx, 30 cases, plus four sheet cases — isDateOnly: false kept on its released token, label and editor, a components Editor override and PowerSearchFilterEditor receiving timezoneID, the western round trip moving the day and back — the accessible label checked through the removal announcement ("Removed Due: on Mar 9, 2024", no time), the range case asserting the write (March 11–12 picked in the calendar store each day's Los Angeles midnight); 17 fail on main (the 11 that pass are the UTC-host or UTC-zone cases where the old code agreed by accident).

Writing rubric results

  • R1 narration: the compatibility bullet first told the history of the released behavior; trimmed to what the correction is and what a caller observes.
  • R2 research in the record: none; the reproduction table lives here.
  • R3 evidence naming a change: none; the verification row names the test file and its failure signal.
  • R4 rejected alternatives over one line or outside a decision: four in DEC-5, each one line; DEC-3's date rejection reworded to one line that points at FR25–FR25.
  • R5 pull request or issue references remaining: none (searched # + digits, /pull/, /issues/).
  • R6 ruled open questions still listing options: the date known gap is resolved and removed; the isDateOnly: false question stays open, reworded to say what today's rule is.

Scope

  • One defect is restored (the three readings of one value disagreeing). The isDateOnly: false editor is split out into its own pull request.
  • Separable contradictory or unsettled tagalongs were removed or split: none remain; the isDateOnly: false editor is its own pull request.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run packages/core/src/PowerSearch packages/core/src/Table/plugins/filtering packages/core/src/i18n — all pass; PowerSearchDateZone.test.tsx 30/30 here (host zones × timezoneID; token, label, editor, round trip, range parts, Token and Editor overrides, PowerSearchFilterEditor, isDateOnly: false untouched), plus four sheet cases (the value step opens on the day in timezoneID and stores that zone's midnight: Tokyo, Honolulu, unset; a components Editor override in the value step receives timezoneID); 17 of the popover cases fail on main.
  • pnpm -F @astryxdesign/core typecheck, typecheck:docs — clean.
  • ASTRYX_STRICT_LINT=1 eslint on packages/core/src/PowerSearch/ — 0 findings.

Release category: why this is a fix

  • FR32's test. spec:AST-017 FR32 makes a correction [breaking] only when "a valid latest-stable consumer relies on that behavior such that the correction breaks … persisted data". Before this change, no valid consumer could rely on how PowerSearch reads a date-only date_absolute.
  • One stored value, three zones. The token text formats in the viewer's zone and ignores timezoneID (formatDateAbsoluteCompact). The accessible label and the removal announcement format in timezoneID with a time of day (formatDateAbsolute). The editor reads and writes the UTC day (toISOString). For a viewer west of UTC, the token shows one day and the editor opens on the next, and re-picking the day the token showed stores the day before it. A consumer "relying" on this relies on the drift itself.
  • Restores the documented contract (FR5). timezoneID is documented as "Timezone ID for date formatting", yet the released token ignores it and the editor never receives it.
  • Current authority already names it wrong. component:PowerSearch DEC-3 states the one-day-one-zone rule for the sheet and records the popover's date handling as a known gap (FR32's first clause).
  • Who it reaches. Only callers that pass timezoneID; in this repository only Storybook stories do, and no template, app or package does. With timezoneID unset, stored values don't change, and the token and label now show the UTC day the editor already used. That is a visible correction with no released victim, which FR32 keeps [fix].
  • The configuration the prop exists for. For a caller passing timezoneID whose viewers are in that zone, the token already showed the day in that zone. The editor now opens on that same day, and a picked day stores as that zone's midnight, so reading the stored value in the zone the caller asked for gives the day the person picked. The stored instant changes only for a consumer that reads the value as a UTC day while asking PowerSearch for another zone — the inconsistency being fixed, not a valid reliance.
  • The changeset names every observable change, including that a saved value also moves on the token for a viewer at or east of UTC.

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 3, 2026 9:38pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 2, 2026
@astracat-bot

astracat-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 3, 2026, 9:48 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 5ec3631

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
PowerSearch · Storybook 195.1 kB (+734 B) · 21.6 kB CSS (0) 6,948 (+159) ✓ · ✓ · ✓

Package size: @astryxdesign/core 6.24 MB packed (+3.5 kB); no new dependencies.

API changes: core +1 · ~0 · −0

1 API change (advisory)
Package Where Signature Usage
+ core . · Components · component PowerSearchToken prop timezoneID?: string <PowerSearchToken timezoneID={…} />

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering-owner decision on the proposed component:PowerSearch DEC-4, FR22 and FR23, which replace the current FR17 rule that the date editors read and write UTC days and settle the open isDateOnly: false question. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. These fixes are needed either way:

  • With timezoneID unset, Lab MobilePowerSearch now shows one day on its token and row and another in its editor (Tokyo: token "Mar 8, 2024", calendar March 9), because powerSearchDateZone.ts copies Lab's four conversion helpers from mobilePowerSearchUtils.ts with a UTC fallback where Lab keeps the viewer's zone, so please keep one implementation in Core, have Lab call it, and correct the new Lab JSDoc.
  • The [fix] changeset tag contradicts spec:AST-017 FR5, FR6 and FR32, because the change replaces the documented UTC-day rule and its own text names a caller it breaks: please classify it per FR32 and FR33, and list in the record and the changeset that formatFilterValue and the accessible label drop the time of day for every date-only value.
  • <PowerSearch timezoneID=""> now throws RangeError: Invalid time zone specified on render where the base treated "" as unset, so please test if (timezoneID) in resolveDateZone.
  • The required lint check fails because formatFilterValue.test.ts is not Prettier-formatted, so please run Prettier on it.

The range editor's write path also has no test: the case named "reads and writes them in timezoneID" asserts only the read.

[Automated review]

* UTC day, so this prop does not change a date value today.
* The zone date values are shown and edited in: tokens, rows and the date
* editors read a `date_absolute` in it and a picked day stores as its
* midnight there. Unset, the viewer's zone.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer holds after the Core change. With timezoneID unset, the token and rows format through Core's formatFilterValue, which now reads UTC, while MobilePowerSearchValueEditor still reads the viewer's zone. In Tokyo a value saved for March 9 shows "Mar 8, 2024" on the token and March 9 in the calendar. Keep one zone rule for both, then describe it here.


const pad = (n: number, width = 2) => String(n).padStart(width, '0');

export function unixSecondsToISODate(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These four helpers repeat unixSecondsToISODate, unixSecondsToISODateTime, isoDateTimeToUnixSeconds and isoDateToUnixSeconds in packages/lab/src/MobilePowerSearch/mobilePowerSearchUtils.ts:521-592, which fall back to the viewer's zone instead of UTC. Keep one implementation in Core and have Lab call it, so the two cannot drift.

timezoneID: string | undefined,
isDateOnly: boolean,
): string | undefined {
if (timezoneID != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty string passes this test, reaches Intl.DateTimeFormat, and makes <PowerSearch timezoneID=""> throw RangeError: Invalid time zone specified on render. The base treated "" as unset. Suggest if (timezoneID) {.

Comment thread .changeset/powersearch-date-zone.md Outdated
'@astryxdesign/core': patch
---

[fix] PowerSearch: a `date_absolute` value reads as one day in one zone — on the token, in the accessible label and announcements, and in the edit popover's date editor — and the editor writes the day picked. Before, the token showed the device's day and the editor read and wrote the UTC day, ignoring `timezoneID`, so west of UTC a filter opened on the day after the one its token showed and re-picking that day moved the value a day earlier. Now, with `timezoneID` set, every reading uses that zone and a picked day stores as that zone's midnight (it stored UTC midnight before: a caller passing `timezoneID` sees a different saved instant, the midnight of the day shown, and a caller east of UTC that derived the day from the instant's UTC date reads the day before — read it in `timezoneID`); with `timezoneID` unset the stored day stays UTC midnight and the token now shows the UTC day too, so no stored value changes. `isDateOnly: false` now gets a date-and-time editor and a time on the token, reading and writing wall-clock time in `timezoneID`, else the viewer's zone; it was a date-only editor storing midnight. Range parts follow the date-only rule.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec:AST-017 FR5 says a change that replaces the documented contract is not a fix. CURRENT FR17 documents UTC-day reads and writes, and this text names a caller the change breaks (east of UTC, reading the UTC date). FR6 and FR32 then make it [breaking], with the corrected contract and migration. Please also note that formatFilterValue and the accessible label drop the time of day for date-only values.

so a field that passed `timezoneID` showed one day on its token and another
in its editor; the correction makes the editor honor the documented prop.
With no `timezoneID` the stored day of a date-only value is unchanged (UTC
midnight in, UTC midnight out) and only the token's text changes where the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With no timezoneID, the accessible label and the public formatFilterValue also change, in every zone: they drop the time of day and read UTC (Los Angeles: "Mar 8, 2024, 4:00 PM" becomes "Mar 9, 2024"). "No caller in the repository does" is the likelihood argument spec:AST-017 FR6 rules out.

// Copyright (c) Meta Platforms, Inc. and affiliates.

import {describe, expect, it} from 'vitest';
import {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier wants this import on one line (import {formatDateAbsolute, formatFilterValue} from './formatFilterValue';). The required lint check fails here and never reaches ESLint.

});

describe('range parts are calendar days in the same zone', () => {
it('reads and writes them in timezoneID', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: this case asserts only the read and that onChange was not called, so the DateRangeEditor write path (isoDateToUnixSeconds(range.start, zone)) has no test. Pick a range and assert each part stores that zone's midnight, or rename the case.

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 84ab832

@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from b461e88 to 84ab832 Compare November 2, 2026 23:53
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision about the five functions this pull request adds to the published @astryxdesign/core/PowerSearch/utils entry point (resolveDateZone, unixSecondsToISODate, isoDateToUnixSeconds, unixSecondsToISODateTime, isoDateTimeToUnixSeconds). No spec decides them yet, so an owner either names them in the PowerSearch record or asks for a non-public home that Lab can import. The date-zone direction itself (DEC-4, FR22, FR23) is approved at this head. These fixes are needed either way:

  • With timezoneID set, the exported PowerSearchFilterEditor and PowerSearchToken still read UTC days, because PowerSearch passes no timezoneID to components overrides and neither part forwards one: a Tokyo field shows "Mar 11, 2024" beside an editor on March 10, so please pass and forward the zone (or narrow FR22 to the built-in parts).
  • The [fix] patch changeset conflicts with spec:AST-017 FR5, FR7 and FR32: it names a caller that must change (one reading the stored instant's UTC date), and the new helpers are an addition, so please classify the stored-instant change [breaking] with its migration under FR31 to FR34 and give any public helpers their own [feat] entry.
  • The changeset says each range part's day shows on the token and in the label, but the range token and formatFilterValue still read "date range", so please limit that sentence to the range editor.
  • The changeset credits @xinzi, while your earlier changesets credit @imdreamrunner, so please credit the handle the release notes should thank.

Non-blocking: the FR22/FR23 verification row promises accessible-label checks that the new suite does not make.

[Automated review]

saveButtonLabel={popoverSaveButtonLabel}
maxMenuItems={maxOperatorMenuItems}
isReadOnly={isReadOnly}
timezoneID={timezoneID}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The built-in popover gets the zone here, but the components Editor override a few lines up (<EditorOverride …/>) and the Token override (<TokenOverride …/>) get none, although PowerSearchEditorProps declares timezoneID. The exported PowerSearchFilterEditor also drops it before PowerSearchEditPopover. With timezoneID="Asia/Tokyo", the Editor override opens on March 10 beside a "Mar 11, 2024" token. Passing timezoneID={timezoneID} to EditorOverride and forwarding it in PowerSearchFilterEditor fixes the editor side.

@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec:AST-017 FR5 and FR32: this text names a caller that must change (one deriving the day from the stored instant's UTC date), so the stored-instant change is [breaking], not a patch [fix]. With a patch declared on main, FR34 asks for an opt-in beside the old behavior, or the change waits for a declared minor. The new public helpers are a [feat] addition (FR7).

Comment thread .changeset/powersearch-date-zone.md Outdated
'@astryxdesign/core': patch
---

[fix] PowerSearch: a `date_absolute` value reads as one day in one zone — on the token, in the accessible label and announcements, and in the edit popover's date editor — and the editor writes the day picked. Before, the token showed the device's day, the label showed a date and a time in `timezoneID`, and the editor read and wrote the UTC day without receiving `timezoneID`, so west of UTC a filter opened on the day after the one its token showed and re-picking that day moved the value a day earlier. Now a date-only value (`isDateOnly` unset or true) and each range part is a calendar day in `timezoneID`, else the UTC day: the token shows that day; the accessible label and `formatFilterValue` show that day with no time of day (UTC midnight March 9 in Los Angeles read "Mar 8, 2024, 4:00 PM" and reads "Mar 9, 2024"); the editor opens on it; and a picked day stores as that zone's midnight — with `timezoneID` set this is a different instant from the UTC midnight stored before, so a caller that derived the day from the instant's UTC date reads it in `timezoneID` instead; with `timezoneID` unset no stored value changes. `isDateOnly: false` is an instant: a date-and-time editor and a time on the token and label, in `timezoneID`, else the viewer's zone; it had the date-only editor and stored midnight. `@astryxdesign/core/PowerSearch/utils` adds the zone helpers (`resolveDateZone`, `unixSecondsToISODate`, `isoDateToUnixSeconds`, `unixSecondsToISODateTime`, `isoDateTimeToUnixSeconds`) so Lab reads dates the same way.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"each range part … the token shows that day; the accessible label and formatFilterValue show that day": the range token renders "date range" and formatFilterValue returns "date range" for a date_range. Only the range editor reads days. Suggested: "each absolute range part is read and written as a calendar day in timezoneID, else the UTC day, in the range editor".

Comment thread .changeset/powersearch-date-zone.md Outdated

[fix] PowerSearch: a `date_absolute` value reads as one day in one zone — on the token, in the accessible label and announcements, and in the edit popover's date editor — and the editor writes the day picked. Before, the token showed the device's day, the label showed a date and a time in `timezoneID`, and the editor read and wrote the UTC day without receiving `timezoneID`, so west of UTC a filter opened on the day after the one its token showed and re-picking that day moved the value a day earlier. Now a date-only value (`isDateOnly` unset or true) and each range part is a calendar day in `timezoneID`, else the UTC day: the token shows that day; the accessible label and `formatFilterValue` show that day with no time of day (UTC midnight March 9 in Los Angeles read "Mar 8, 2024, 4:00 PM" and reads "Mar 9, 2024"); the editor opens on it; and a picked day stores as that zone's midnight — with `timezoneID` set this is a different instant from the UTC midnight stored before, so a caller that derived the day from the instant's UTC date reads it in `timezoneID` instead; with `timezoneID` unset no stored value changes. `isDateOnly: false` is an instant: a date-and-time editor and a time on the token and label, in `timezoneID`, else the viewer's zone; it had the date-only editor and stored midnight. `@astryxdesign/core/PowerSearch/utils` adds the zone helpers (`resolveDateZone`, `unixSecondsToISODate`, `isoDateToUnixSeconds`, `unixSecondsToISODateTime`, `isoDateTimeToUnixSeconds`) so Lab reads dates the same way.

@xinzi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release notes render this as "thanks @xinzi". Your earlier changesets credit @imdreamrunner, the handle on this pull request.

Comment thread packages/core/src/PowerSearch/utils.ts Outdated
Comment on lines +10 to +16
export {
isoDateTimeToUnixSeconds,
isoDateToUnixSeconds,
resolveDateZone,
unixSecondsToISODate,
unixSecondsToISODateTime,
} from './powerSearchDateZone';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These five functions become public API on the published @astryxdesign/core/PowerSearch/utils entry point, and no record names them yet. An engineering owner needs to decide whether they stay public.

* The one reading of a `date_absolute` value: a date-only value is its
* calendar day in the zone `resolveDateZone` names, a date-and-time value is
* its wall-clock time there. The token text, the accessible label, and the
* editors share it, so a value never reads as two days in one field.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: the editors do not call formatDateAbsolute. Suggested: "The token text and the accessible label share it. The editors read the same zone through resolveDateZone."

@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from 84ab832 to f175024 Compare November 3, 2026 01:17
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec f175024

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 64ff3b2

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. The date-zone direction (DEC-4, FR22, FR23) is approved at this head, and the code matches it: the token, the accessible label and the editor now read one day in one zone, and isDateOnly: false gets a date-and-time editor. One change is needed before merge:

  • The [fix] patch Changeset conflicts with spec:AST-017 FR5, FR32 and FR34, because its own text says a caller that reads the stored instant's UTC date must change once timezoneID is set, so please classify that storage change [breaking] with its migration for a declared minor, or ship it in this patch as an opt-in beside UTC-midnight storage.

Non-blocking: the western round-trip test also passes on the base, and no test checks that an Editor override or PowerSearchFilterEditor receives timezoneID.

[Automated review]

@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec:AST-017 FR5 and FR32: line 5 names a caller that must change when timezoneID is set (one that reads the stored instant's UTC date), so this storage change is [breaking], not a patch [fix]. With a patch declared on main, FR34 asks for an opt-in beside UTC-midnight storage, or the change waits for a declared minor with its migration (FR8, FR33).

});
});

it('a date-only round trip through the editor keeps its day in a western zone', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: this case also passes on the base, so it does not guard the stored instant. Picking a different day and then the token's day again, or using a timezoneID east of UTC, would make it fail on the old code.

@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from 64ff3b2 to 1dcfd92 Compare November 3, 2026 04:29
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 1dcfd92

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. The date-zone direction (DEC-4, FR23) is approved at this head, and the Core code matches it: the token, the accessible label and the editor now read one day in one zone.

Blocking:

  • The [fix] patch Changeset contradicts spec:AST-017 FR5, FR32 and FR34: with timezoneID set, a newly picked day stores a different instant, and a filter saved as UTC midnight under a western timezoneID now reads a day earlier, so ship the storage change as [breaking] with a migration in a declared minor, or as an opt-in beside UTC-midnight storage in this patch.
  • The Changeset and the record's compatibility bullet leave out that isDateOnly: false values also lose their time of day and change zone in formatFilterValue, the label and the token, and that released UTC-midnight values under a western timezoneID shift a day; name both.
  • Lab MobilePowerSearch now shows "Mar 10, 2024" on an isDateOnly: false token whose date-and-time editor opens on March 9, 7:00 PM (Los Angeles clock, no timezoneID), because the shared formatter prints the UTC day while that editor reads the viewer's zone; format that token and its row in the editor's zone and add a test.

One non-blocking comment-wording suggestion is inline.

[Automated review]

@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec:AST-017 FR5, FR32 and FR34: this change has released victims, so it cannot ship as a patch [fix]. With timezoneID set, a newly picked day stores that zone's midnight instead of UTC midnight, and a filter the released editor saved as UTC midnight March 9 under timezoneID="America/Los_Angeles" now reads March 8 on the token and in the editor on every device. FR6 rules out approval as a reason. Ship it as [breaking] with its migration in a declared minor (FR31, FR33), or in this patch as an opt-in beside UTC-midnight storage (FR34, FR28).

Comment thread .changeset/powersearch-date-zone.md Outdated
'@astryxdesign/core': patch
---

[fix] PowerSearch: a `date_absolute` value reads as one day in one zone — on the token, in the accessible label and announcements, and in the edit popover's date editor — and the editor writes the day picked. Before, the token showed the device's day, the label showed a date and a time in `timezoneID`, and the editor read and wrote the UTC day without receiving `timezoneID`, so west of UTC a filter opened on the day after the one its token showed and re-picking that day moved the value a day earlier. Now a date-only value (`isDateOnly` unset or true) is a calendar day in `timezoneID`, else the UTC day: the token shows that day; the accessible label and `formatFilterValue` show that day with no time of day (UTC midnight March 9 in Los Angeles read "Mar 8, 2024, 4:00 PM" and reads "Mar 9, 2024"); the editor opens on it; and a picked day stores as that zone's midnight — with `timezoneID` set this is a different instant from the UTC midnight stored before, so a caller that derived the day from the instant's UTC date reads it in `timezoneID` instead; with `timezoneID` unset no stored value changes. Each absolute `date_range` part is read and written as a calendar day the same way in the range editor. A `components` Editor override and `PowerSearchFilterEditor` receive `timezoneID`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two observable changes are missing here (AST-017 FR7: the Changeset body is the whole declaration). formatDateAbsolute ignores isDateOnly, so for isDateOnly: false values formatFilterValue and the label also drop the time and read UTC when timezoneID is unset ("Mar 9, 2024, 7:00 PM" becomes "Mar 10, 2024" on a Los Angeles device). And values the released editor stored as UTC midnight under a western timezoneID now read a day earlier. Please name both here and in the record's compatibility bullet.

Comment on lines +519 to +521
// Core owns the zone rule: a calendar day reads in `timezoneID`, else the UTC
// day; an instant reads in `timezoneID`, else the viewer's zone. Lab calls the
// same conversions, so the token, the rows and the editors cannot drift.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not hold for isDateOnly: false. The token and rows format through Core's formatFilterValue, which now prints the UTC day with no time, while unixSecondsToISODateTime below reads the viewer's zone. On a Los Angeles clock with no timezoneID the token reads "Mar 10, 2024" and the editor opens on March 9, 7:00 PM (on the base both read March 9, 7:00 PM). Format the isDateOnly: false token and row text with the time in resolveDateZone(timezoneID, false), and add a Lab test for that token.

Comment on lines +29 to +32
* value written before a zone was given keeps its day. A wall-clock time
* (the Lab prototype's date-and-time editor) is an instant shown in
* `timezoneID`, else the viewer's zone, which `undefined` names: `Intl` and
* `Date` both default to it, so no zone name is needed for it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (INV29): this sentence packs several topics into 38 words. Suggested: "A wall-clock time shows in timezoneID, else in the viewer's zone. undefined names the viewer's zone, because Intl and Date default to it."

@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from 1dcfd92 to b195ea4 Compare November 3, 2026 05:20
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec b195ea4

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. The date-zone direction (DEC-4, FR23) is approved at this head, and the code matches it: a date-only value now reads as one day on the token, in the accessible label and in the editor, and isDateOnly: false values keep their released reading.

Blocking:

  • The [fix] patch Changeset (.changeset/powersearch-date-zone.md:2, :5) needs to become [breaking] with its migration once main declares a minor, or the timezoneID storage change needs to ship as an opt-in beside the released UTC-midnight behaviour, because spec:AST-017 FR5, FR32 and FR34 classify a correction that breaks persisted values (UTC midnight March 9 under America/Los_Angeles now reads March 8) as breaking, and FR6 rules out approval as a reason.
  • The Changeset's lead sentence and the title say every date_absolute value now reads as one day, but isDateOnly: false values still read as two days (your own tests at PowerSearchDateZone.test.tsx:389-427), so lead with "a date-only date_absolute value (isDateOnly unset or true)" and say "date-only value" in the title.

One non-blocking comment-wording suggestion is inline.

[Automated review]

@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec:AST-017 FR5, FR32 and FR34: callers that pass timezoneID are released victims, so this cannot ship as a patch [fix]. A day picked under Asia/Tokyo now stores 2024-03-10T15:00Z instead of 2024-03-11T00:00Z, and a value the released editor saved as UTC midnight March 9 under America/Los_Angeles now reads March 8 on every device; line 5 itself tells those callers to re-save. FR6 rules out approval as a reason. Ship it as [breaking] with the migration once main declares a minor, or ship the zone-midnight reading as an opt-in beside the released behaviour (FR34, FR28).

Comment thread .changeset/powersearch-date-zone.md Outdated
'@astryxdesign/core': patch
---

[fix] PowerSearch: a `date_absolute` value reads as one day in one zone — on the token, in the accessible label and announcements, and in the edit popover's date editor — and the editor writes the day picked. Before, the token showed the device's day, the label showed a date and a time in `timezoneID`, and the editor read and wrote the UTC day without receiving `timezoneID`, so west of UTC a filter opened on the day after the one its token showed and re-picking that day moved the value a day earlier. Now a date-only value (`isDateOnly` unset or true) is a calendar day in `timezoneID`, else the UTC day: the token shows that day; the accessible label and `formatFilterValue` show that day with no time of day (UTC midnight March 9 in Los Angeles read "Mar 8, 2024, 4:00 PM" and reads "Mar 9, 2024"); the editor opens on it; and a picked day stores as that zone's midnight — with `timezoneID` set this is a different instant from the UTC midnight stored before, so a caller that derived the day from the instant's UTC date reads it in `timezoneID` instead, and a value the old editor stored as UTC midnight under a `timezoneID` west of UTC now reads the day before (UTC midnight March 9 under `America/Los_Angeles` reads March 8), the day it would have stored — re-save such values, or read them as UTC days; with `timezoneID` unset no stored value changes. Each absolute `date_range` part is read and written as a calendar day the same way in the range editor. An operator with `isDateOnly: false` is untouched: its token, label and editor read as before. A `components` Editor override and `PowerSearchFilterEditor` receive `timezoneID`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lead says "a date_absolute value reads as one day in one zone", but isDateOnly: false values still read as two days (token on the device's day, label in timezoneID, editor on the UTC day; PowerSearchDateZone.test.tsx:389-427). Suggested lead: "a date-only date_absolute value (isDateOnly unset or true), and each absolute date_range part, reads as one day in one zone". The title needs the same qualifier.

Comment on lines +314 to +315
// A calendar day reads in the one zone the editor uses; a value with a
// time of day keeps the token's released reading.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (INV29): two topics in one sentence, and "released reading" does not say what the reader sees. Suggested: "A date-only value reads in the editor's zone. A value with a time of day keeps the device's day."

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the date-zone fix is well tested and its record change is approved by an engineering owner, but its release category does not follow the repository's compatibility rules.

  • The [fix] patch Changeset contradicts spec:AST-017 FR5, FR32 and FR34, because a caller that passes timezoneID now stores a different instant for a picked day (March 11 under Asia/Tokyo stores 2024-03-10T15:00Z instead of 2024-03-11T00:00Z) and sees values saved earlier under a western zone a day earlier; ship the zone-midnight storage as an opt-in beside the released behavior in this patch, or as [breaking] with its migration once main declares a minor.

When the Changeset is rewritten, say that a saved value also moves on a device at UTC, as the record does ("at or east of UTC"). Three new source comments could be shorter; the suggestions are inline and do not block.

[Automated review]

Comment thread .changeset/powersearch-date-zone.md Outdated
'@astryxdesign/core': patch
---

[fix] PowerSearch: a date-only `date_absolute` value (`isDateOnly` unset or `true`) reads as one day in one zone — on the token, in the accessible label and announcements, and in the edit popover's date editor — and the editor writes the day picked. Before, the token showed the device's day, the label showed a date and a time in `timezoneID`, and the editor read and wrote the UTC day without receiving `timezoneID`, so west of UTC a filter opened on the day after the one its token showed and re-picking that day moved the value a day earlier. Now a date-only value (`isDateOnly` unset or true) is a calendar day in `timezoneID`, else the UTC day: the token shows that day; the accessible label and `formatFilterValue` show that day with no time of day (UTC midnight March 9 in Los Angeles read "Mar 8, 2024, 4:00 PM" and reads "Mar 9, 2024"); the editor opens on it; and a picked day stores as that zone's midnight — with `timezoneID` set this is a different instant from the UTC midnight stored before, so a caller that derived the day from the instant's UTC date reads it in `timezoneID` instead, and a value the old editor stored as UTC midnight under a `timezoneID` west of UTC now reads the day before in the editor, and on the token east of UTC (UTC midnight March 9 under `America/Los_Angeles` reads March 8 everywhere; a Los Angeles device's token and the label already did), the day it would have stored — re-save such values, or read them as UTC days; with `timezoneID` unset no stored value changes. Each absolute `date_range` part is read and written as a calendar day the same way in the range editor. An operator with `isDateOnly: false` is untouched: its token, label and editor read as before. A `components` Editor override and `PowerSearchFilterEditor` receive `timezoneID`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec:AST-017 FR5, FR32 and FR34: callers that pass timezoneID are released victims, so this cannot ship as a patch [fix]. A March 11 pick under Asia/Tokyo stored 2024-03-11T00:00Z and now stores 2024-03-10T15:00Z, and this text tells callers to re-save values saved earlier. Either ship the zone-midnight storage as an opt-in beside the released UTC-midnight behavior (FR34, FR28), or mark it [breaking] with its migration once main declares a minor (FR31, FR33). When rewriting, "on the token east of UTC" should read "at or east of UTC": a UTC device's token moves too.

Comment on lines +315 to +316
// A calendar day reads in the one zone the editor uses; a value with a
// time of day keeps the token's released reading.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (INV29): two topics in one sentence, and "released reading" does not say what the reader sees. Suggested: "A date-only value reads in the editor's zone. A value with a time of day keeps the device's day."

Comment on lines +431 to +433
// A calendar day edits in the one zone the token and the label read it in.
// A value whose operator sets `isDateOnly: false` keeps the released
// date-only picker on the UTC day.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (INV29): "released" narrates history. Suggested: "A date-only value edits in the zone the token and the label use. An isDateOnly: false value edits its UTC day."

timezoneID: string | undefined,
isDateOnly: boolean,
): string | undefined {
// An empty string is no zone, as the formatter always read it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (INV29): "as the formatter always read it" narrates history. Suggested: "An empty string means no zone."

@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from e9f06ea to 4c96401 Compare November 3, 2026 17:33
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 4c96401

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the date-zone fix is well tested and its record change is approved by an engineering owner, but two items need fixing before merge.

  • The [fix] patch Changeset contradicts spec:AST-017 FR5, FR32 and FR34, because a caller that passes timezoneID now gets a different stored instant for a picked day (March 11 under Asia/Tokyo stored 2024-03-11T00:00Z, which a Tokyo viewer's token and editor already read as one day, and now stores 2024-03-10T15:00Z) and values saved earlier under a western zone read a day earlier, so ship the zone-midnight storage as an opt-in beside the released behavior in this patch, or as [breaking] with its migration in a declared minor.
  • In the sheet presentation a components Editor override still receives no timezoneID (the EditorOverride render in PowerSearchBottomSheet.tsx), although FR14 gives it the popover's props, FR25 says it receives the zone and the Changeset promises it, so pass timezoneID there and add a sheet case to PowerSearchDateZone.test.tsx.

The review also lists non-blocking suggestions: DEC-3's prototype differences that this change makes stale, an [experimental] Changeset for the sheet part, and comment wording.

[Automated review]

@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec:AST-017 FR5, FR32 and FR34: callers that pass timezoneID are released victims, so this cannot ship as a patch [fix]. A March 11 pick under Asia/Tokyo stored 2024-03-11T00:00Z (and a Tokyo viewer's token and editor already agreed) and now stores 2024-03-10T15:00Z; a value saved as UTC midnight under America/Los_Angeles reads a day earlier on a UTC device. Ship the zone-midnight storage as an opt-in beside the released behavior (FR34, FR28), or as [breaking] with its migration once main declares a minor (FR31, FR33, FR8).

fieldLabel={draftField.label}
isDisabled={isEditorDisabled}
maxMenuItems={maxOperatorMenuItems}
timezoneID={timezoneID}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The built-in editor gets the zone here, but the EditorOverride this step renders (line 2409) still gets no timezoneID, while the popover passes it (PowerSearch.tsx:1266). FR14 gives the sheet's override "the props the popover presentation hands it, with the same meaning", and FR25 says it receives the zone. With timezoneID="America/Los_Angeles" the row reads "Due on Mar 9, 2024" but the override cannot know that day. Pass timezoneID={timezoneID} to it and add a sheet case to PowerSearchDateZone.test.tsx.

@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from 4c96401 to 314e6c9 Compare November 3, 2026 18:09
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 314e6c9

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the date-zone fix is well tested and its record change is approved by an engineering owner, but one item blocks merge.

  • The [fix] patch Changeset contradicts spec:AST-017 FR5, FR32 and FR34, because a caller that passes timezoneID now stores a different instant for a picked day (March 11 under Asia/Tokyo stored 2024-03-11T00:00Z, which a Tokyo viewer's token and editor already read as one day, and now stores 2024-03-10T15:00Z) and values saved earlier under a western zone read a day earlier, so ship the zone reading and storage for timezoneID callers as an opt-in beside the released behavior in this patch, or as [breaking] with its migration once main declares a minor.

The sheet presentation's Editor override now receives timezoneID, which resolves the earlier finding. The review also lists non-blocking suggestions: two DEC-3 prototype differences this change makes stale, PowerSearchToken having no way to read the zone, and an [experimental] Changeset for the sheet part.

[Automated review]

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 7150d79

@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from 7150d79 to 5ec3631 Compare November 3, 2026 20:19
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 5ec3631

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the date-zone fix matches the current PowerSearch record and its tests are thorough, but one regression guard needs to come back.

  • formatFilterValue.test.ts:277 drops the Thai-calendar case for formatDateAbsoluteCompact and for the time-of-day branch of formatDateAbsolute, which still render isDateOnly: false tokens and labels, so removing calendar: 'gregory' from either now passes every PowerSearch test; add both back to the loop.

Worth fixing in the same push: the commit message still says the record gains DEC-5 and FR24 and that Lab's MobilePowerSearch uses the new conversions, and neither is true at this head. unixSecondsToISODateTime and isoDateTimeToUnixSeconds are never called and belong with the isDateOnly: false editor change. The timezoneID docs say every date value is read and written in that zone, which is not yet true for isDateOnly: false values.

[Automated review]

for (const value of [
formatDateAbsolute(unixSeconds, 'th-TH', 'UTC'),
formatDateAbsoluteCompact(unixSeconds, 'th-TH'),
formatDateAbsolute(unixSeconds, 'th-TH', undefined),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop no longer covers formatDateAbsoluteCompact, which still renders every isDateOnly: false token (formatTokenValue.ts:186). It also no longer covers the time-of-day branch of formatDateAbsolute, which the label uses. With calendar: 'gregory' removed from either, all PowerSearch tests still pass, and a Thai-locale token or label would show Buddhist-era years. Keep both in the loop:

for (const value of [
  formatDateAbsolute(unixSeconds, 'th-TH', 'UTC'),
  formatDateAbsolute(unixSeconds, 'th-TH', 'UTC', false),
  formatDateAbsoluteCompact(unixSeconds, 'th-TH'),
]) {

return Math.floor(instant / 1000);
}

export function unixSecondsToISODateTime(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: unixSecondsToISODateTime and isoDateTimeToUnixSeconds have no caller or test in this pull request. They belong with the separate isDateOnly: false editor change. The zone == null branches above cannot run either, because resolveDateZone(…, true) never returns undefined.

timezoneID: string | undefined,
isDateOnly: boolean,
): string | undefined {
// An empty string is no zone, as the formatter always read it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (INV29): the second clause narrates history. Suggested: // An empty string counts as no zone.

* different options threaded through a param, since the two callers want
* genuinely different shapes, not a parameterization of the same one.
* The released token text for a value with a time of day: its day in the
* viewer's zone, as the token has always shown it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (INV29): "as the token has always shown it" narrates history. Suggested: "Token text for a value with a time of day: its day in the viewer's zone."

type: 'string',
description: 'Timezone ID for date formatting (e.g. "America/New_York").',
description:
'IANA zone the date values are read and written in: a calendar day shows, edits and stores (as that midnight) in it; unset, a day is its UTC day. E.g. "America/New_York".',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: an isDateOnly: false value is not yet read or written in this zone. Its token shows the device's day and its editor stores UTC midnight. Suggested: 'IANA zone a date-only value is shown, edited and stored (as that midnight) in; unset, its UTC day. E.g. "America/New_York".' The dense entry at line 575 needs the same narrowing.

@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from 5ec3631 to 79eebb8 Compare November 3, 2026 20:59
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 79eebb8

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the date-zone fix matches the current PowerSearch record and its tests are thorough, but one unintended change needs to come out.

  • PowerSearchToken.tsx:70 forwards timezoneID into the time-of-day formatter, so a components Token override that wraps PowerSearchToken now shows an isDateOnly: false value in timezoneID ("Mar 9, 2024, 7:00 PM" becomes "Mar 10, 2024, 12:00 PM" for a Los Angeles viewer of an Asia/Tokyo field), while the record's Compatibility section says such a value is untouched; pass timezoneID only for a date-only value and add that override case to PowerSearchDateZone.test.tsx.

The earlier Gregorian-calendar test gap is fixed. Two optional cleanups: the zone == null branches in powerSearchDateZone.ts cannot run, and one date-only zone assertion in formatFilterValue.test.ts would back the FR25 verification row's "formatter's unit tests".

[Automated review]

adjustedMaxLength,
t,
locale,
timezoneID,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PowerSearch now hands timezoneID to every components Token override, so an override that renders <PowerSearchToken {...props} /> reaches this line with it set. For an operator with isDateOnly: false, formatFilterValue then formats the date and time in timezoneID instead of the viewer's zone: a Los Angeles viewer of an Asia/Tokyo field sees "Mar 10, 2024, 12:00 PM" where the released token showed "Mar 9, 2024, 7:00 PM". The record's Compatibility section says such a value is untouched. Suggested:

    operator.value.type === 'date_absolute' && operator.value.isDateOnly === false
      ? undefined
      : timezoneID,

…, and edits it there

Three readers of one unixSeconds used three zones: the token formatted in the
device's zone, the accessible label in timezoneID, and the edit popover's date
editor read and wrote the UTC day, never receiving timezoneID. West of UTC a
filter opened on the day after the one its token showed, and re-picking that
day moved the value a day earlier.

A date-only date_absolute value (isDateOnly unset or true), and each absolute
range part, is now a calendar day in timezoneID, else the UTC day, on the
token, in the label and announcements, in the sheet's rows and value step,
and in the editor, and a picked day stores as that zone's midnight; with no
timezoneID no stored value changes. The exported PowerSearchToken and a
components Token or Editor override receive timezoneID. A value whose
operator sets isDateOnly: false keeps its released reading. The record's FR25
implementation-gap notes come off, as the popover now meets them.
@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-date-zone branch from 79eebb8 to 35dc8d8 Compare November 3, 2026 21:27
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

/approve-spec 35dc8d8

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommending approval. The date-zone fix matches the current PowerSearch record (FR25, DEC-5): a date-only value now reads as one day on the token, the label and the editor, a picked day stores as that zone's midnight, and an isDateOnly: false value keeps its released reading, including through PowerSearchToken. The new tests fail on the base and pass here.

Two optional cleanups:

  • The changeset says PowerSearchToken previously "showed the label's date and time", but it never received timezoneID, so it showed a date and time in the viewer's zone; suggested: "where it showed a date and time in the viewer's zone".
  • powerSearchDateZone.ts handles zone == null at lines 48 and 60, but every caller passes a string, so typing zone as string removes both branches and the plainDateFromDate and plainDateToDate imports.

[Automated review]

'@astryxdesign/core': patch
---

[fix] PowerSearch: a date-only `date_absolute` value (`isDateOnly` unset or `true`) reads as one day in one zone — on the token, in the accessible label and announcements, and in the edit popover's date editor — and the editor writes the day picked. Before, the token showed the device's day, the label showed a date and a time in `timezoneID`, and the editor read and wrote the UTC day without receiving `timezoneID`, so west of UTC a filter opened on the day after the one its token showed and re-picking that day moved the value a day earlier. Now a date-only value (`isDateOnly` unset or true) is a calendar day in `timezoneID`, else the UTC day: the token shows that day; the accessible label and `formatFilterValue` show that day with no time of day (UTC midnight March 9 in Los Angeles read "Mar 8, 2024, 4:00 PM" and reads "Mar 9, 2024"); the editor opens on it; and a picked day stores as that zone's midnight — with `timezoneID` set this is a different instant from the UTC midnight stored before, so a caller that derived the day from the instant's UTC date reads it in `timezoneID` instead, and a value the old editor stored as UTC midnight under a `timezoneID` west of UTC now reads the day before in the editor on every device, and on the token for a viewer at or east of UTC (UTC midnight March 9 under `America/Los_Angeles` reads March 8 everywhere; a Los Angeles viewer's token and the label already did), the day it would have stored — re-save such values, or read them as UTC days; with `timezoneID` unset no stored value changes. Each absolute `date_range` part is read and written as a calendar day the same way in the range editor. An operator with `isDateOnly: false` is untouched: its token, label and editor read as before. In the sheet presentation the rows and the value step read and write the same day. The exported `PowerSearchToken` and a `components` Token override receive `timezoneID` (a new optional prop on `PowerSearchTokenProps`), and `PowerSearchToken` shows that day too, where it showed the label's date and time. A `[fix]`, not a breaking change: the released popover read one value in three zones, so nothing valid relied on how a day was stored, and `timezoneID` is documented for date formatting. A `components` Editor override and `PowerSearchFilterEditor` receive `timezoneID`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: before this change PowerSearchToken never received timezoneID, so it showed a date and time in the viewer's zone, not the label's timezoneID date and time. Suggested: "and PowerSearchToken shows that day too, where it showed a date and time in the viewer's zone".

const instant = unixSeconds * 1000;

return plainDateToISO(
zone == null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: every caller passes resolveDateZone(…, true) or 'UTC', so zone is never undefined here or at line 60. Typing zone as string removes both branches and the plainDateFromDate and plainDateToDate imports.

@imdreamrunner
imdreamrunner merged commit 40c6e41 into main Nov 3, 2026
60 checks passed
@github-actions
github-actions Bot deleted the fix/powersearch-date-zone branch November 4, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 35dc8d84 Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant