Show the sender's timezone in reply/forward intro lines (#7352) - #10249
Draft
MiMoHo wants to merge 1 commit into
Draft
Show the sender's timezone in reply/forward intro lines (#7352)#10249MiMoHo wants to merge 1 commit into
MiMoHo wants to merge 1 commit into
Conversation
The "On <date>, <sender> wrote:" reply intro and the forward header formatted the original message date in the quoting user's local time without any timezone information, which is ambiguous for recipients in other timezones. Format the date in the sender's original timezone and append the explicit UTC offset instead, like Mutt and Claws Mail do (approach suggested in roundcube#7352 and welcomed by the maintainer there). This also fixes rcmail::format_date() for string input with $convert=false: the strtotime()/'@timestamp' roundtrip dropped the timezone specified in the input, so dates were rendered in UTC - neither the user's nor the original timezone (also reported in roundcube#7352). Use rcube_utils::anytodatetime(), which preserves the input timezone and has the same strtotime() fallback. The existing callers using $convert=false (contact birthday-type fields, managesieve vacation dates) render dates in their original timezone now, instead of a possibly day-shifted UTC rendering. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MiMoHo
force-pushed
the
reply-intro-timezone-7352
branch
from
July 19, 2026 02:26
a1b9344 to
01959b9
Compare
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.
Implements #7352. Opened as a draft to agree on the exact format/behavior before finalizing (see the questions below).
What it does
The reply intro (
On <date>, <sender> wrote:) and the forward header (Date: <date>) currently show the original message date converted to the quoting user's local time, with no timezone information — ambiguous for everyone else reading the reply. With this change, the date is formatted in the sender's original timezone with an explicit UTC offset, like Mutt and Claws Mail do (as suggested in the issue and welcomed there):The user's configured
date_longformat is still honored (localization included); onlyO(the offset) is appended.Bug fixed along the way
@metalefty's in-house attempt in the issue failed because
rcmail::format_date($string, $fmt, false)didn't behave as documented: for string input, thercube_utils::strtotime()→new DateTime('@'.$ts)roundtrip discards the timezone contained in the input, so with$convert=falsedates were rendered in UTC — neither the user's nor the original timezone. This PR switches the parsing torcube_utils::anytodatetime()(which preserves the input's timezone and falls back to the samestrtotime()), making$convert=falsefinally mean "keep the original timezone".Impact on existing
$convert=falsecallers (contact date fields incontacts/index.php, managesieve vacation dates): they now render dates in the timezone they were written in, instead of a UTC rendering that could be shifted by a day for servers with non-zero UTC offsets — a latent off-by-one fixed by this change. Behavior for$convert=true(all other callers) is unchanged: same instant, converted to the user's timezone as before. Invalid/zero dates (0000-00-00 00:00:00) still return an empty string (now guarded explicitly).Questions for maintainers (why this is a draft)
date_long . ' O'the right format (e.g.2020-04-28 10:35 +0900), or would you prefer a dedicated config option (e.g.reply_date_format) so admins/users can control it?O/eto theirdate_formatsettings. I'd keep it out of scope here.Testing
ComposeTest::test_get_reply_header()asserting the exact intro line for a+0900message date.RcmailTest::test_format_date()extended: string input with$convert=falsepreserves the input offset,$convert=trueconverts as before; empty/invalid/zero-date inputs return''.RcubeTest::test_exec, BSD vs GNUdateon macOS, unrelated).php-cs-fixerandphpstanclean on all changed files.This contribution was prepared with AI assistance (Claude Code); analysis and test results were verified as described.
🤖 Generated with Claude Code