Timestamps are off by several hours in slack snap after recent update

After a recent slack update to version 4.34.115, the timestamp on received messages is off by four hours. I’ve tried setting the timezone manually instead of the default autodetect, but that doesn’t seem to make any difference. Where can one file a bug report for the slack app?

Have you tried slack contact URL?

maciek@galeon:~ snap info slack |grep contact
contact:   https://get.slack.help/hc/en-us

Thanks, I just submitted a bug report through their help center.

The help center was quick to respond, and I’ll leave the workaround here just in case anyone else runs into the same issue:

This is a known issue affecting Linux users, where the app is defaulting to UTC if there’s no TZ value in a user’s ~/.profile. Check for a TZ value there (or in ~/.bashrc), and if there isn’t one, run the tzselect command in Terminal to select one, then log out and back in to Linux.

Basically, exporting the TZ environment variable with the correct timezone works around the issue that was introduced with the recent update.

1 Like

Heh, that’s quite an odd expectation … why would people set a per-user timezone at all, instead of using the machines timezone value…

Would anyone expect users on multi-user desktop systems to be in different timezones?

When the slack snap starts I see an apparmor DENIED message for /etc/. I wonder if it’s trying to read /etc/timezone and then falls back to using the TZ environment variable. When neither works it defaults to UTC.

Can you leave a link to the ticket? Just for the record, access to /etc/localtime is allowed by default for any snap:

Normally this is a symlink to say /usr/share/zoneinfo/Europe/Berlin, which is also valid when within a snap (though it technically points to a file inside the base snap).

Thanks for the information, so that would be a better source of system-wide timezone information instead of the TZ environment variable. It looks like the slack help tickets are private, but I’ve added this information to the ticket and a link to this forum post as feedback in the hope that it reaches the slack snap packaging team.

1 Like

FYI it is not actually the TZ environment variable of the logged in session that the Slack snap app is looking at, but rather the ${HOME}/.profile file explicitly.

I use Zsh as my shell and I tested setting up the TZ env var in my Zsh settings, and it didn’t fix the problem, even after reboot, even though the TZ value was set for the session.

But setting it in the ${HOME}/.profile, per the recommended workaround, and then re-logging fixed the problem.

I agree with the earlier comment that it is not the correct approach to require the user to configure a TZ setting in this file to specify the correct timezone… There are a number of ways that the correct timezone can be detected, and Slack should be falling back on them appropriately if the user hasn’t set an explicit TZ setting for their session.

I’m not sure that’s correct, e.g. specifying the TZ variable on the command line while launching slack will also set the timezone correctly even if the .profile file has no TZ declaration:

 TZ="America/New_York" slack