Skip to content

Hand the timeline's date comparison off to the Comparison plugin - #339

Open
sandesh-sp wants to merge 1 commit into
developmentfrom
feat/timeline-compare-handoff
Open

Hand the timeline's date comparison off to the Comparison plugin#339
sandesh-sp wants to merge 1 commit into
developmentfrom
feat/timeline-compare-handoff

Conversation

@sandesh-sp

Copy link
Copy Markdown
Collaborator

Summary

Timeline-side groundwork for comparing two dates on the map. The timeline's Compare date action becomes real, DateSelector becomes reusable outside the timeline header, and the picker is corrected to work in UTC.

What's here

Compare hand-off. Clicking Compare date announces plugin:comparison:startWithDates on the mmgisAPI bus. The timeline knows the Comparison plugin only by the name of that event — a mission that doesn't load the plugin is one where nobody listens, not one where the timeline breaks.

DateSelector becomes embeddable. Three additions let another layout reuse the component as-is:

  • className — appended to the root, so an embedder can position it
  • placeholder — wording shown in place of a formatted date, so a date the user hasn't picked yet reads as an invitation while the calendar still opens around selectedDate
  • onCompareClick — the Compare date action and its divider are drawn only when a handler is supplied

UTC correctness. MMGIS stores every instant in UTC, but the picker was formatting and parsing in local time. A viewer west of Greenwich saw — and committed — the wrong day. Every moment(...) in DateSelector and DayCalendar is now moment.utc(...).

Stylesheet split. DateSelector.css and FloatingPopover.css move out of Timeline.css and are imported by the components that own them, so the pieces travel with their directories. lib/css-imports.d.ts declares plain .css imports, mirroring the scss-imports.d.ts other plugins' libs carry.

Timeline window on the bus. mmgisGetTimeStart / mmgisGetTimeEnd / mmgisGetTimeCurrent expose the timeline's window to tools that need to read it without owning it.

Tests

src/essence/Tools/Timeline/__tests__/ — 10 cases, 2 files:

  • DateSelector.spec.tsx pins the process timezone to America/Los_Angeles before importing the component. On a UTC CI host, local and UTC formatting are identical and a local-time regression would pass; under this zone it surfaces as a wrong day or a shifted clock.
  • TimelineAdapter.spec.tsx covers that the action is offered and that clicking it puts the event on the bus.
npx vitest run src/essence/Tools/Timeline/__tests__
 Test Files  2 passed (2)
      Tests  10 passed (10)

Notes for review

This is the timeline half only. The map-side comparison work — side-by-side layout and per-side date pins — lives on feat/compare-tool-core and lands separately; nothing here depends on it. The emitted event has no listener until that branch merges, which is the intended failure mode.

The "Compare date" action announces 'plugin:comparison:startWithDates' on the
bus instead of calling anything: the timeline knows the Comparison plugin only
by the name of that event, so a mission without the plugin is one where nobody
listens rather than one where the timeline breaks.

DateSelector grows the pieces an embedding layout needs to reuse it — an
appended className, placeholder wording for a date the user has not picked yet,
and an optional onCompareClick that draws the action and its divider only when
a handler is given.

The picker also reads and writes UTC throughout. MMGIS stores every instant in
UTC, so a viewer west of Greenwich was seeing and committing the wrong day; the
specs pin the process timezone to America/Los_Angeles so a local-time
regression cannot pass on a UTC CI host.

The date selector and popover carry their own stylesheets rather than living in
Timeline.css, and mmgisAPI exposes the timeline's start, end, and current
instants for tools that need the window without owning it.
@sandesh-sp
sandesh-sp marked this pull request as ready for review August 26, 2026 15:00
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