In the following environment, the message posted today was sometimes displayed as "Yesterday".
"ExperimentalTimezone": false
in config.jsonPost a message between 00:00 and 09:00 JST in the above environment
Posts at JST 07:00 (UTC 22:00) should be labeled "Today".
Posts at JST 07:00 (UTC 22:00) are labeled "Yesterday".
According to the content posted on Twitter by other Japanese user, "Yesterday" is displayed before JST 09:00 (UTC 00:00), and "Today" is displayed after that time.
(https://twitter.com/ken_kiku/status/1323061018004660225)
As a workaround, setting ExperimentalTimezone
to true
will display it correctly.
Thanks, opened a ticket: https://mattermost.atlassian.net/browse/MM-30489.
Hey @maruTA-bis5, I think changing ExperimentalTimezone to true here will do the job. Can you please confirm so that I can go ahead and make the change? Thanks!
Also, @amyblais, can you assign this to me? :)
@amyblais, I am sorry for the trouble but can you tag someone who can confirm whether what I wrote above sounds good? Thank you!
@calebroseland Can you help with the question here https://github.com/mattermost/mattermost-server/issues/16259#issuecomment-726686534?
@haardikdharma10 ExperimentalTimezone: true
will indeed fix this, but technically I believe it's a bug.
It seems like a discrepancy between the date-part ('Yesterday'/'Today') and the time-part.
The relative-time parsing in datetime.ts is explicitly UTC-based if no timezone is provided (e.g. ExperimentalTimezone: false
), whereas the Date constructor used to parse the value in timestamp.tsx implicitly uses the client/browser timezone if no timezone is provided.
Maybe removing the explicitly-UTC there would do the trick? (not 100%; doing this might bring up other issues)
- const momentA = moment.utc(a.getTime());
- const momentB = moment.utc(b.getTime());
+ const momentA = moment(a);
+ const momentB = moment(b);
Downside is the tests and/or time mocks in timestamp.test.tsx would probably need to be updated, but given this issue/bug, a couple of the tests there are probably faulty anyway.
@calebroseland, thanks for the explanation. I appreciate your time:) I'll give it a go.