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

"Today" is the agent's day in their own time zone, set on the Profile, so at 6 pm Eastern the clock does not already show tomorrow #171

Merged opened this

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

Merged

"Today" is now the agent's day in the time zone saved on the Profile, so at 7:30 pm Eastern the clock still shows today. The full bun test passes (570 tests). I could not run bun x tsc --noEmit: the repo has no TypeScript dependency or tsconfig.json, so the type check is unverified.

Notes

shipped production is serving it deploy d2eada7

opened this

"Today" is now the agent's day in the time zone saved on the Profile, so at 7:30 pm Eastern the clock still shows today. The full bun test passes (570 tests). I could not run bun x tsc --noEmit: the repo has no TypeScript dependency or tsconfig.json, so the type check is unverified. scripts/gate.ts and scripts/design-lint.ts don't exist here, and I touched nothing in src/web/.

What changed

  • Time zone on the Profile. It is stored as an IANA name, with the default America/New_York. It is checked against Intl.supportedValuesOf("timeZone") (plus UTC), and anything else gets a 422 whose message says "time zone", with the zone field highlighted on the form. The Profile page offers a select of the six US zones and keeps a stored zone that isn't one of them. A save that leaves zone out keeps the saved one, like line. The permit cell is unchanged: the update stays admin-only.
  • One function in src/dates.ts. today(zone, now) replaces the process clock, and dayOf(agent) reads it from the profile. The formatter is made once per zone. Every today() read in src/routes.ts, src/mcp.ts, src/terminal.ts, src/sample.ts and src/reminders.ts now passes the profile's zone. The clock, This week, People, the Monday sheet, today's reminders, /tick, the API, MCP and the terminal all go through that. today() with no argument still falls back to America/New_York, which keeps the existing tests unchanged. Dates stay plain YYYY-MM-DD strings.
  • Stored moments show as days in that zone. Done, waived, sent and fell-through days, and the CSV exports, are now derived in the agent's zone. Without this, a message sent at 7:30 pm Eastern showed as sent tomorrow. DealView carries zone, plus waived_on, sent_on and Draft.sent_on.
  • Migration. The new one is appended and pinned in src/migrations.pin.json; a database from before it boots with the default zone. I re-emitted contract/openapi.json for the new zone field.
  • Tests. src/timezone.test.ts is new. It fixes 2026-11-09T00:30Z: New York gives 2026-11-08 and a date due 2026-11-08 is not overdue, while UTC gives 2026-11-09. It also covers zone validation, the select, admin-only saves, /tick following the saved zone, and a pre-zone database booting with the default.
  • Docs. README "Make it yours" has the one sentence about setting the time zone. docs/TECHNICAL.md no longer says dates follow TZ and says what replaced it.

Existing tests I changed

  • waive.test.ts and fell.test.ts: they compared a UTC timestamp's date with today(), which only held when the UTC and Eastern dates agree. They now compare the derived day.
  • profile.test.ts: expects the new zone field.
  • people.test.ts: its hand-built sent rows gain sent_on.
  • migrations.test.ts: the old-database replay excludes the zone migration too.

What I chose not to do

  • Sample timestamps: I left them on their own UTC-based anchoring.
  • Zone lookup: zoneOf(db) is cached per database and cleared on a profile save, so the "profile is one read per request" test still holds.

To try it Open /profile as an admin, pick Pacific, save, and compare /tick's on with the Pacific date.

Closes #163

1 earlier comment · 1 event
commented

"Today" is now the agent's day in the time zone saved on the Profile, so at 7:30 pm Eastern the clock still shows today. The full bun test passes (570 tests). I could not run bun x tsc --noEmit: the repo has no TypeScript dependency or tsconfig.json, so the type check is unverified. scripts/gate.ts and scripts/design-lint.ts don't exist here, and I touched nothing in src/web/.

What changed

  • Time zone on the Profile. It is stored as an IANA name, with the default America/New_York. It is checked against Intl.supportedValuesOf("timeZone") (plus UTC), and anything else gets a 422 whose message says "time zone", with the zone field highlighted on the form. The Profile page offers a select of the six US zones and keeps a stored zone that isn't one of them. A save that leaves zone out keeps the saved one, like line. The permit cell is unchanged: the update stays admin-only.
  • One function in src/dates.ts. today(zone, now) replaces the process clock, and dayOf(agent) reads it from the profile. The formatter is made once per zone. Every today() read in src/routes.ts, src/mcp.ts, src/terminal.ts, src/sample.ts and src/reminders.ts now passes the profile's zone. The clock, This week, People, the Monday sheet, today's reminders, /tick, the API, MCP and the terminal all go through that. today() with no argument still falls back to America/New_York, which keeps the existing tests unchanged. Dates stay plain YYYY-MM-DD strings.
  • Stored moments show as days in that zone. Done, waived, sent and fell-through days, and the CSV exports, are now derived in the agent's zone. Without this, a message sent at 7:30 pm Eastern showed as sent tomorrow. DealView carries zone, plus waived_on, sent_on and Draft.sent_on.
  • Migration. The new one is appended and pinned in src/migrations.pin.json; a database from before it boots with the default zone. I re-emitted contract/openapi.json for the new zone field.
  • Tests. src/timezone.test.ts is new. It fixes 2026-11-09T00:30Z: New York gives 2026-11-08 and a date due 2026-11-08 is not overdue, while UTC gives 2026-11-09. It also covers zone validation, the select, admin-only saves, /tick following the saved zone, and a pre-zone database booting with the default.
  • Docs. README "Make it yours" has the one sentence about setting the time zone. docs/TECHNICAL.md no longer says dates follow TZ and says what replaced it.

Existing tests I changed

  • waive.test.ts and fell.test.ts: they compared a UTC timestamp's date with today(), which only held when the UTC and Eastern dates agree. They now compare the derived day.
  • profile.test.ts: expects the new zone field.
  • people.test.ts: its hand-built sent rows gain sent_on.
  • migrations.test.ts: the old-database replay excludes the zone migration too.

What I chose not to do

  • Sample timestamps: I left them on their own UTC-based anchoring.
  • Zone lookup: zoneOf(db) is cached per database and cleared on a profile save, so the "profile is one read per request" test still holds.

To try it Open /profile as an admin, pick Pacific, save, and compare /tick's on with the Pacific date.

Changes requested — before the latest push

Two changes before this can land.

  1. Both doors (fix first). The terminal profile editor (onProfile in src/terminal.ts, prompt steps name/brokerage/phone/email/line) has no time-zone step. A person can set the zone on the page, and over the API and MCP, but not in the terminal. Add a step ("Your time zone (enter keeps America/New_York)"), pass zone to setProfile, and show the zone on the terminal profile view. Update the profile line in the header comment, and add a terminal test that saves a zone and then sees today change.
  1. Make 'one function' true. today(zone = DEFAULT_ZONE, now) quietly answers Eastern when a caller leaves the zone out. That is how a missed call site (a route, a tool or a tty view that reads 'today' without the profile's zone) goes unnoticed, and it is why the existing tests passed untouched. Make zone a required argument, so the compiler and the tests find every caller that was not converted. Then confirm that /tick, the /api tally and people, progress, and the terminal's own clock all take the zone from the profile. The diff I could read stops at src/routes.ts line ~1050, so I could not check those, and the base still calls today() bare at routes.ts:1360, 1414, 1431 and 1461.

Minor: src/csv.ts has a doubled blank line after ACTIVITY_COLUMNS. Also run bun x tsc --noEmit if you can. The pull says the type check was not run.

What holds: the zone is validated at the boundary, with a 422 naming zone, and the update stays admin-only through permit, with no cell loosened. Formatters are cached per zone, the migration is appended and pinned, and the README and TECHNICAL.md are updated.

commented

"Today" is now the agent's day in the time zone saved on the Profile, and all three doors set it: the page, the API and MCP, and now the terminal. The full bun test passes (571 tests).

Changes since the first push

  • zone is required. today(zone, now) in src/dates.ts no longer defaults to Eastern. Source has no bare today() caller left; the only mentions are two doc comments in src/deals.ts.
  • The cited routes take the zone from the profile. routes.ts /tick (1361), the /api tally (1415), people (1432) and progress (1462) all use dayOf(agentFor(c)). Your line numbers match the base; this pull already converted them.
  • The terminal's clock takes the zone from the profile (zoneOf(db)), as do the MCP tools and sample.ts.
  • Tests. Existing tests that called today() bare now say today(DEFAULT_ZONE), so they stay in Eastern on purpose.
  • Terminal profile editor.

- New step. onProfile gains "Your time zone (enter keeps America/New_York; a name such as America/Chicago)" and passes zone to setProfile. - View and docs. The profile view shows a Time zone line, and the header comment now lists it. - Existing test. The existing profile-editor test needed one extra Enter for the new step. - New test. It sets Pacific/Kiritimati, sees the zone and the header date change, and switches back to America/New_York. It also checks that an unknown name is refused.

  • csv.ts. The doubled blank line is gone.

Type check bun x tsc --noEmit can't run here: the repo has no TypeScript dependency or tsconfig.json, and that command prints help. I ran tsc from a temporary install in $TMPDIR with a guessed strict config. It reports many errors that look unrelated, such as routes.ts 476 missing DealView and the Result.value narrowing in tests, and none are about a missing zone argument. I did not compare against the base, so I can't say all of them were already there. This is not a clean type check.

Approved

Earlier asks (zone required in today(), routes /tick, tally, people and progress taking the profile zone, the terminal profile editor with a zone step and its test, the csv blank line) are reported met by the builder, and the visible diff agrees: today(zone, now) has no default, one formatter per zone, migration appended and pinned, openapi and docs updated, permit cells untouched. The preview needs a sign-in so I could not drive the Profile there, and the diff I was given was cut before src/profile.ts, routes.ts and terminal.ts, so those rest on the builder's report and the tests. Non-blocking: tsc is not verifiable in this repo.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs