Skip to content

calendar: use the host's calendar field names so all-day and multi-day events render in the Calendar view #172

Closed

Description

@michielbdejong

From Michiel's calendar user-testing session.

The calendar drive app (#101/#145) writes the shortnames day and all-day, and has no end-day property. The host's Calendar view (atomic-server CalendarView.tsx) reads the shared contract in @tomic/lib calendarFields (browser/lib/src/calendar-date.ts):

  • atomic-calendar-day: a civil date YYYY-MM-DD;
  • atomic-calendar-all-day: a boolean;
  • atomic-calendar-end-day: the inclusive last day;
  • atomic-calendar-notes.

Each can also carry an lt-google-calendar-property- prefix. Imported ranges are opt-in: only rows whose date column matches atomic-calendar-day get all-day and multi-day handling. So the app's all-day and multi-day events render as single-day events in the host view, which is also where the app's Month button hands off to.

Decision: fix the app, not the host. calendarFields is the shared contract other importers follow.

Fix:

  • rename the app's day → atomic-calendar-day and all-day → atomic-calendar-all-day;
  • add atomic-calendar-end-day (the inclusive last day, derived from Google's exclusive end);
  • write the event description to atomic-calendar-notes if the app imports one;
  • release as app 0.1.1, since published modules are immutable;
  • extend the e2e to open the host Calendar view and assert that a multi-day all-day event spans its days.

Existing installs are experimental test installs only, so there's no migration beyond a re-import.

Activity

  1. michielbdejong commented on Sep 25, 2026

    @michielbdejong
    ContributorAuthor

    Correction to the description: the host treats atomic-calendar-end-day as exclusive, not the inclusive last day. The Calendar view shows an all-day row on days ≥ day and < end-day, and adding an item in that view sets end-day to the day after. So the fix writes Google's own exclusive end date for all-day events. For timed events that cross midnight it writes the date the event ends, and for single-day timed events no end-day. The fix is ready (calendar app 0.1.1, with an e2e that opens the host Calendar view and checks that a 3-day event spans exactly the 10th–12th) and waits for #171 to land first.

  2. michielbdejong commented on Sep 29, 2026

    @michielbdejong
    ContributorAuthor

    Summary of a design discussion on ontola/atomic-server#1803 ("Calendar: the exclusive End day leaks into the UI"). No code came out of it. The approach below was vetoed for now in favour of a simpler fix, which will be worked out separately.

    Problem. The fix in the comment above writes Google's exclusive end into atomic-calendar-end-day. In user testing, a trip from 16 to 18 Nov had to be entered with End day = 19 Nov. Google's own UI shows 16–18. Only its API uses the exclusive form.

    Where the translation belongs. The leak comes from integrations/calendar/devonian/google-calendar/lens/projection.ts (values[calendarFields.endDay] = end.date). Because the app is two-way, the plugin's lens (projection.ts inbound, edit.ts / planCalendarValues outbound) is the natural place for it: the Atomic row stores Atomic's meaning, Google keeps its own, and the lens converts ±1 day. The host needs a matching change: calendarFields / isAllDayOnDate / nextCalendarDate in @tomic/lib, and event creation in CalendarView.tsx.

    Ideas we explored and set aside:

    • Bidirectional lens in the host UI only. This leaves sort, filters, dashboards, Rust expression filters, export and the AI chat seeing a different value from the grid.
    • Store the source's form and translate at every reader. The value would be tagged with its form: lastDay / endBefore / endAt+zone. Queries would be translated rather than data, which works exactly for monotone, invertible lenses like the ±1 day shift and becomes a range for instant→day. It is sound, but too big a change.
    • An editable computed column ("Last day = Ends before − 1", built on the host's offset derived column). It was prototyped, but it touches the shared table cell, and it was discarded.

    Things to keep in mind:

    • An instant end ("00:00 Thursday") only becomes a day once a timezone is known. Days are inclusive and instants are exclusive, which is why early translation of timed ends loses information.
    • The host's offset derived column shows a DATE source one day early west of UTC. It goes through a UTC-midnight instant and then toLocaleDateString.
    • Related: Michiel's "intent sourcing" notes, and Design: two-way sync as an observation log + Devonian lens (CRDT-like), starting with Clockify #97 (observation log + Devonian lens).
  3. michielbdejong commented on Sep 29, 2026

    @michielbdejong
    ContributorAuthor

    Picking up (atomic-plugins worker session): checking calendar 0.1.1 (#194, merged into #171's branch) against Michiel's decision on ontola/atomic-server#1803.

    • The data in Atomic keeps the host's existing format, including the exclusive atomic-calendar-end-day.
    • The Google → Atomic lens translates to that format.
    • The app's own agenda and week views must draw exactly the days the built-in Calendar view draws (isAllDayOnDate: start ≤ day < end), including edge cases such as end == start (calendar: read all-day events with end == start as one day #184) and timed events that cross midnight.

    Any fix lands as a follow-up PR against main. The built-in view's own behaviour is out of scope; changing it would mean a new property on the class, and that's a separate decision.

  4. added a commit that references this issue on Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions