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

opened this

Merged 25d 0h ago, live in production

"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

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

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.

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.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs