Public: anyone can read this; the crew can change it.

Times on the lead page and the Activity page read in the agent's time zone, not the server's #67

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Every clock time on the lead page, the desk and Activity now reads in the agent's profile time zone instead of the server's UTC. bun test passes (323 tests) and bun run lint:design printed no errors. I couldn't run bun x tsc --noEmit or scripts/gate.ts, because the clone has no tsconfig.json or scripts/gate.ts.

Notes

shipped production is serving it deploy aba151a

opened this

Every clock time on the lead page, the desk and Activity now reads in the agent's profile time zone instead of the server's UTC. bun test passes (323 tests) and bun run lint:design printed no errors. I couldn't run bun x tsc --noEmit or scripts/gate.ts, because the clone has no tsconfig.json or scripts/gate.ts. That matters here: tsc was meant to find missed callers, and one slipped through.

What changed

  • Required zone: when(iso, zone) and day(iso, zone) in src/pages/parts.ts now take the zone as a required argument and pass it to toLocaleString. consent(lead, zone) takes it too, because its "opted out" date calls day.
  • Callers:

- src/pages/lead.ts passes agent.timeZone for the inquiry time, messages, replies, calls, note edit time, follow-up plan days, the hold-until date and the lost date. - src/pages/desk.ts passes the zone for the "Next follow-up" day and the consent badge. - src/pages/activity.ts passes it for each row.

  • Missed caller: I first missed noteCard, which calls when outside leadPage. bun test caught it as a 500 on the lead page, and noteCard now takes the zone as a parameter.
  • <time> tags: the lead page already wrapped its times in <time datetime="…">. Activity rows did not, so they now carry the ISO instant too.
  • Activity title: the line under the title now ends "Times are in America/Los_Angeles." (or whichever zone the profile holds).
  • Tests: the new src/timezone.test.ts renders a lead created at 2026-11-02T01:30Z with the profile set to America/Los_Angeles. It asserts <time datetime="…">Nov 1, 5:30 PM</time>, which fails on the old code and its UTC "Nov 2, 1:30 AM". It also covers the Activity zone line and rows, and that leadsCsv still emits the ISO instant.

Not done

  • The CSV export is unchanged. src/export.test.ts already pinned ISO instants in the CSV; the new test pins that the profile zone doesn't change them.
  • I didn't change any permit cell or contract.json.

Try it: set the profile time zone to America/Los_Angeles, open a lead and check the "They asked" time, then open /activity as an admin.

🤖 Generated with Claude Code

Closes #65

1 earlier comment · 1 event
commented

Every clock time on the lead page, the desk and Activity now reads in the agent's profile time zone instead of the server's UTC. bun test passes (323 tests) and bun run lint:design printed no errors. I couldn't run bun x tsc --noEmit or scripts/gate.ts, because the clone has no tsconfig.json or scripts/gate.ts. That matters here: tsc was meant to find missed callers, and one slipped through.

What changed

  • Required zone: when(iso, zone) and day(iso, zone) in src/pages/parts.ts now take the zone as a required argument and pass it to toLocaleString. consent(lead, zone) takes it too, because its "opted out" date calls day.
  • Callers:

- src/pages/lead.ts passes agent.timeZone for the inquiry time, messages, replies, calls, note edit time, follow-up plan days, the hold-until date and the lost date. - src/pages/desk.ts passes the zone for the "Next follow-up" day and the consent badge. - src/pages/activity.ts passes it for each row.

  • Missed caller: I first missed noteCard, which calls when outside leadPage. bun test caught it as a 500 on the lead page, and noteCard now takes the zone as a parameter.
  • <time> tags: the lead page already wrapped its times in <time datetime="…">. Activity rows did not, so they now carry the ISO instant too.
  • Activity title: the line under the title now ends "Times are in America/Los_Angeles." (or whichever zone the profile holds).
  • Tests: the new src/timezone.test.ts renders a lead created at 2026-11-02T01:30Z with the profile set to America/Los_Angeles. It asserts <time datetime="…">Nov 1, 5:30 PM</time>, which fails on the old code and its UTC "Nov 2, 1:30 AM". It also covers the Activity zone line and rows, and that leadsCsv still emits the ISO instant.

Not done

  • The CSV export is unchanged. src/export.test.ts already pinned ISO instants in the CSV; the new test pins that the profile zone doesn't change them.
  • I didn't change any permit cell or contract.json.

Try it: set the profile time zone to America/Los_Angeles, open a lead and check the "They asked" time, then open /activity as an admin.

🤖 Generated with Claude Code

Changes requested — before the latest push

The web pages are right and the tests are good, but the terminal Activity screen still shows times in the server zone. Fix: in src/terminal.ts (~line 478) the activity view formats row.at with new Date(row.at).toLocaleString("en-US", {...}) and no timeZone, so it reads UTC while the page reads Pacific. Both doors must agree. Pass timeZone: currentAgent(db).timeZone there (or reuse when(row.at, zone) from pages/parts.ts), and add a line saying which zone the times are in, as the page does. Add a terminal test with a known instant and a Pacific profile that fails without the change. Boxes 1 and 3 are left until the terminal agrees; the rest are met.

commented

The terminal Activity screen now reads in the agent's profile time zone, so it matches the web page. bun test passes (324 tests) and bun run lint:design printed no errors. I couldn't run bun x tsc --noEmit, because the clone has no tsconfig.json.

  • Fix: In src/terminal.ts, activityScreen now formats each row with when(row.at, zone) from pages/parts.ts, where zone is currentAgent(db).timeZone. This replaces the bare toLocaleString call that used the server's zone.
  • Zone note: The screen has a dim line under its title, "Times are in America/Los_Angeles." (or whichever zone the profile holds). It is passed through clean, like the other profile text the terminal prints.
  • Test: The new test in src/terminal.test.ts sets the profile to America/Los_Angeles and gives the audit rows the instant 2026-11-02T01:30Z. It asserts "Nov 1, 5:30 PM" and the zone line appear, and "Nov 2, 1:30 AM" does not. It fails on the previous terminal.ts and passes now.

The rest of the pull is unchanged: the web pages, the desk and the CSV export keep what I described before.

🤖 Generated with Claude Code

Approved

The terminal Activity screen now uses the agent zone and says which, with a test. That meets my earlier ask for the terminal door. Every caller of when, day and consent that I could find passes the zone. No permit cell changed. Non-blocking: a scheduled message renders <time datetime="">, which was already the case before this pull.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs