fix(gmail): render quoted and forwarded dates in Gmail's human style#873
Conversation
Reply and forward attributions emitted the original message's raw RFC 2822
Date header verbatim, e.g. "On Wed, 17 Jun 2026 00:29:51 -0500, ... wrote:"
and "Date: Wed, 17 Jun 2026 00:29:51 -0500". Reformat it to the
human-readable style Gmail uses ("Wed, Jun 17, 2026 at 12:29 AM") across
all four render paths: reply plain, reply HTML, forward plain, forward HTML.
Like Gmail, the timestamp is converted into the user's timezone rather than
left in the sender's offset. The location is resolved via the existing
mailDateLocation helper, so it honors GOG_TIMEZONE / default_timezone and
falls back to the local timezone -- the same resolution already used for the
outgoing Date header. An unparseable Date is left as-is (trimmed) so it
never breaks the quote or forward block.
The new formatQuoteDate and the existing formatGmailDateInLocation now share
a formatMailDateInLocation core (they differed only in the output layout).
Includes unit coverage for formatQuoteDate and the HTML reply/forward
attribution paths; existing reply/forward/draft tests updated to the new
format.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed June 23, 2026, 2:55 AM ET / 06:55 UTC. Summary Reproducibility: yes. from source: current main's reply and forward renderers pass the original Date header through unchanged. The PR body also gives a concrete live-account command path showing the before input and after output, though I did not run Gmail commands in this read-only review. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Land the focused formatter change after normal required checks pass, keeping reply and forward quote date rendering aligned with the existing configured timezone behavior. Do we have a high-confidence way to reproduce the issue? Yes from source: current main's reply and forward renderers pass the original Date header through unchanged. The PR body also gives a concrete live-account command path showing the before input and after output, though I did not run Gmail commands in this read-only review. Is this the best way to solve the issue? Yes: reusing a shared mail date formatter and applying it to the reply and forward render paths is the narrowest maintainable fix for this output polish. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fc13b4147e20. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
What
Reply and forward attributions emitted the original message's raw RFC 2822
Dateheader verbatim —On Wed, 17 Jun 2026 00:29:51 -0500, … wrote:andDate: Wed, 17 Jun 2026 00:29:51 -0500. This reformats it to the human style Gmail uses —On Wed, Jun 17, 2026 at 12:29 AM, … wrote:— across all four render paths: reply plain, reply HTML, forward plain, forward HTML.Why
The raw RFC 2822 date is jarring in a quoted reply/forward; Gmail (and most clients) render a human-readable attribution. This brings gog's reply/forward output in line.
Timezone behavior
Like Gmail, the timestamp is converted into the active user's timezone (Gmail renders the quoted date in your timezone, not the original sender's offset). The location is resolved via the existing
mailDateLocationhelper — the same one already used for the outgoingDateheader — so it honorsGOG_TIMEZONE/default_timezoneand falls back to local. An unparseableDateis left as-is so it never breaks the block. (A parseable date's weekday is recomputed from the instant, which also corrects a wrong weekday in the source header.)Changes
formatQuoteDate(raw, loc), applied informatQuotedMessage,formatQuotedMessageHTMLWithContent, andforwardedMessageHeaders.prepareComposeReplyandGmailForwardCmd.RunresolvelocviamailDateLocation.formatQuoteDateand the existingformatGmailDateInLocationnow share a smallformatMailDateInLocationcore — they differed only in the output layout, so this removes the duplication rather than adding a near-twin.Behavior proof
Live against a real account. Redacted in both the commands and the output: the real address appears as
<me>, message ids as<src>/<reply>/<reply-utc>/<fwd>, and thread ids as<thread>/<fwd-thread>. Eachgmail getis piped to the relevant lines. (gmail getrenders the text/plain part; the text/html attribution carries the identical date via the sameformatQuoteDateand is covered by unit tests.)Testing
formatQuoteDate(offset→tz conversion, empty, unparseable fallback);formatQuotedMessageandformatQuotedMessageHTMLWithContentassert the reformatted attribution (incl. the empty-date → "an earlier date" fallback);formatForwardedMessage/…HTMLassert the reformattedDate:line.GOG_TIMEZONEpinned for determinism.make fmt-check lint docs-checkclean.