Bug 237248

Summary: mail/thunderbird: TOC time off by 2 hours when DST is in effect
Product: Ports & Packages Reporter: Craig Leres <leres>
Component: Individual Port(s)Assignee: freebsd-gecko mailing list <gecko>
Status: New ---    
Severity: Affects Only Me CC: ale, lapo
Priority: --- Flags: bugzilla: maintainer-feedback? (gecko)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
9:18 am message show as 7:18
none
10:40pm message shown as 8:40pm none

Description Craig Leres freebsd_committer 2019-04-12 22:59:17 UTC
Created attachment 203628 [details]
9:18 am message show as 7:18

For some time now I've noticed that the displayed message time sometimes differs between the TOC and message itself. I am able to reproduce using a thunderbird package from pkg.freebsd.org but does not happen under windows 10.

My theory is that the code is subtracting instead of adding an hour. I tested this by setting the system time back before DST took effect and the problem went away.

I took a stab at finding the place where TOC date formatting occurs but thunderbird is just too big for someone who doesn't work on it.

I'll attach a couple of screen grabs that show the problem.
Comment 1 Craig Leres freebsd_committer 2019-04-12 23:00:15 UTC
Created attachment 203629 [details]
10:40pm message shown as 8:40pm
Comment 2 Jan Beich freebsd_committer 2019-04-13 00:31:24 UTC
(In reply to Craig Leres from comment #0)
> My theory is that the code is subtracting instead of adding an
> hour. I tested this by setting the system time back before DST took
> effect and the problem went away.

DST adjusts 1 hour but the screenshot show discrepancy in 2 hours. Does it also occur with "TZ=UTC thunderbird"?

> I took a stab at finding the place where TOC date formatting occurs
> but thunderbird is just too big for someone who doesn't work on it.

Code specific to Thunderbird is under comm/mail/, code shared with SeaMonkey is under comm/mailnews/, code shared with Firefox is outside of comm/.
Comment 3 Craig Leres freebsd_committer 2019-04-13 00:39:49 UTC
(In reply to Jan Beich from comment #2)
> Does it also occur with "TZ=UTC thunderbird"?

It works correctly with "env TZ=UTC thunderbird"
Comment 4 Craig Leres freebsd_committer 2019-04-13 03:51:22 UTC
In mozilla-speak the "message list pane" is what I called the TOC.

When I tested the pkg.freebsd.org version of thunderbird I tried to eliminate things that are custom in my environment. So I moved my ~/.thunderbird directory and configured it to talk to an imaps server from scratch. But all of the dependent ports were from my build server.

I have a ubuntu desktop I use for testing and I configured one imaps server on it and it works correctly.

Given that I can only reproduce this on FreeBSD I looked for files in freebsd directories and found some javascript that is doing date things. How is the message list pane rendered?

(Does anybody else see this bug?)
Comment 5 Alex Dupre freebsd_committer 2019-09-16 16:32:55 UTC
I've just switched from seamonkey to thunderbird and I have the same issue: UTC dates in the messages list, while correct date in the top right of the message pane.

Are you sure it worked well without DST? I haven't tried without DST, so it's not clear if the issue is that the hour is substracted instead of added (weird), or simply that it cannot parse the timezone (in particular the CEST abbreviation) and so fallback to UTC.
Comment 6 Alex Dupre freebsd_committer 2019-09-17 12:46:43 UTC
If I start it with "env TZ=Europe/Rome /usr/local/lib/thunderbird/thunderbird" the dates in the message list are correct. Apparently having the correct /etc/localtime and /var/db/zoneinfo files is not enough.
Comment 7 Alex Dupre freebsd_committer 2019-09-17 13:11:17 UTC
My fix/workaround was to add `:timezone=Europe/Rome:` to my .login_conf file in order to set the TZ variable.

This change had a positive impact also on Chrome.

Before:

> (new Date()).getTimezoneOffset()
< 0
> Intl.DateTimeFormat().resolvedOptions().timezone
< CEST

After:

> (new Date()).getTimezoneOffset()
< -120
> Intl.DateTimeFormat().resolvedOptions().timezone
< "Europe/Rome"

I'm aware of other people that haven't the TZ variable and neither this issue (with same /etc/localtime as me), so there must be something else that interfere.
Comment 8 Craig Leres freebsd_committer 2019-09-17 20:44:20 UTC
(In reply to Alex Dupre from comment #6)
I found that using TZ=Howdy or TZ= results in UTC time and in my case TZ=America/Los_Angeles is a decent workaround.