Repository navigation
Conversation
The envelope page wrote every time on the server. The timeline gave
times in UTC without saying so ("Nov 18, 11:00 PM"), the note about the
next reminder used the server's zone without naming it, and the dates
were UTC dates, a day off for a reader in the evening west of Greenwich.
The page is now given the moments themselves and the browser writes
them in the reader's zone, naming the zone wherever a time of day is
shown. The first draw is in UTC on the server and in the browser alike,
so the two match, and the browser then writes the times again in its
own zone. Emails, signed PDFs, certificates and exports keep UTC.
Co-Authored-By: Claude <noreply@anthropic.com>
|
@gagegreg is attempting to deploy a commit to the Basic Intelligence Team on Vercel. A member of the Team first needs to authorize it. |
[Medium impact] The PR appears safe to merge. SummaryThe envelope page shows dates and times in the reader's zone while keeping UTC available on hover. Changes since the previous review:
Both previous findings are addressed. No new actionable issues were found. Tests were not run during this review. Reviews (2) · Last reviewed commit: "Reuse the time formatters, and test that..." · Reviewed by Greptile |
Making an Intl.DateTimeFormat costs far more than using one, and a long timeline made one for every entry on every draw. There is now one for each format and zone in use. The browser test also checks the path that had no test: the browser reports another zone, the reader comes back to the window, and the times are written again in the new zone. Co-Authored-By: Claude <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The envelope page writes its times on the server, so a sender reads them in the server's time zone instead of their own:
The fix. The page is now given each moment as a Unix time, and the browser writes it in the reader's own time zone. Wherever a time of day is shown, the zone is named ("Nov 18, 6:00 PM EST"), so two people reading the same envelope in different places can tell they are looking at the same moment. Hovering over a time shows it in UTC.
Emails, signed PDFs, certificates, the audit trail export and the API are not changed and stay in UTC: one copy of each is read by people in different places. The dashboard list still shows UTC dates. I left it out to keep this to one page, and can follow up if you want it.
We have run an earlier version of this on a self-hosted install since 0.4.0.
How to verify
For agents
Code notes
src/lib/local-time.ts:formatLocalTime(unixSeconds, format, timeZone), with four formats that match what the page already showed. It is pure, so the unit tests give it fixed zones. It keeps oneIntl.DateTimeFormatfor each format and zone in use.src/components/shared/local-time.tsx:<LocalTime>renders a<time dateTime>. It reads the browser's zone throughuseSyncExternalStorewith a server snapshot of"UTC". The server render and the hydration render are therefore the same, and the zone is applied in the render after. It reads the zone again when the window regains focus.src/lib/envelopes.ts:EnvelopeDetailDataand the types under it carry Unix seconds instead of finished labels:createdAt,deadline.expiresAt,manualReminder.nextAvailableAt,timeline[].timestampandsigners[].statusDetail({ label, timestamp? }). Adeadline_changedtimeline item also carriesdeadlineAt, so the page can write "Deadline set to …" in local time; itsdescriptionstill holds the UTC sentence.formatLongDate,formatTimelineTimestampand their formatters had no other use and are removed.getEnvelopeDetailDataForUseris called only by the envelope page and by database tests that readtimeline[].description,signers,copyRecipientsandsignatureTypeLabel. Those tests pass unchanged.src/app/(app)/envelopes/[id]/page.tsx: the deletion notice passesdeleteAfterinstead of a formatted date.formatDeadlineandformatReminderAvailableAt, which emails and API error messages still use, and the dashboard'screatedAtLabel.Tests added
src/lib/local-time.test.ts: the zone is named, the date is the reader's calendar day across UTC midnight, and the hour that repeats when clocks go back is told apart.e2e/viewer-time-zone.spec.ts: a sender inAmerica/Detroitsends an envelope and sees EST or EDT times. A second browser context inEurope/Belgradeopens the same page and sees the samedatetimevalues written as GMT+1 or GMT+2, with no page errors and no hydration warnings. The HTML as the server sends it gives every time of day in UTC, named as UTC. Last, the browser is made to report another zone and the window is focused again, and the times are rewritten in that zone. The spec cannot pass on unmodified main: it looks for<time>elements, and main has none.Commands run (Linux, Node 24.22.3, Postgres 17,
npm cifrom the lockfile, on main at 4d16b88)npm run typecheck: exit 0npm run lint: 0 errors and 8 warnings, none of them in the changed filesnpm run format:check: cleannpm test: 490/490 passnpm run test:db: 410/410 passnpx playwright test signing-flow viewer-time-zone: the new spec passes, and 8 of the 9 tests insigning-flow.spec.tspass. The ninth, "with local disk storage a PDF just under 20 MB uploads, and a larger request is refused", fails the same way on unmodified main on this machine: the upload is still being validated when the 20-second wait ends. I take that to be the machine and not this change.🤖 Generated with Claude Code
Note
Show envelope page times in the reader's local time zone
LocalTimeclient component in local-time.tsx that renders UTC on the server, then switches to the browser's time zone viauseSyncExternalStore. A window focus event re-reads the zone so an already-open page updates.formatLocalTimein local-time.ts with four display formats, a per-zone formatter cache, and time-zone abbreviations for time-of-day values.EnvelopeDetailShellrenders created, deletion, signer status, timeline, and deadline times throughLocalTime.EnvelopeDetailData,EnvelopeDetailTimelineItem, andEnvelopeDeletionNoticetypes if other consumers read them.Macroscope summarized ebea666.