On 1/12/22 7:34 PM, Alan So wrote:
I notice that the template was updated to add the code. However, I still observe an issue.
If the correct hold date is: 2022-01-13 10:16 GMT+8 or 2022-01-13 02:16 GMT If I select my time zone as Asia/Hong_Kong, it is displayed as Jan. 13, 2022, 2:16 a.m. If I select time zone as GMT, it is displayed as Jan. 12, 2022, 6:16 p.m.
There is a shift of -8 hours when displaying the time in Postorius. I cannot find the detail of the held message from database tables yet. Not sure how the hold date was stored at this moment.
As you note later, the hold time is stored in UTC. It should be rendered in Postorius held message view in the timezone that you have set in your user-profile. The timezone conversion is in Django. It is defined in the template as
{{ msg.hold_date|datetime_parse|localtime|date:"DATETIME_FORMAT"}}
where msg.hold_date is the time in UTC. I think the issue is that while msg.hold_date in in UTC, it is a naive datetime.datetime object (see https://docs.djangoproject.com/en/4.0/topics/i18n/timezones/#interpretation-...) so if your Django setting for TIME_ZONE is Asia/Hong_Kong it is interpreted as UTC +0800 so that subtracts 8 hours and then conversion to your profile timezone if Asia/Hong_Kong adds 8 hours back.
I think if you set TIME_ZONE = 'UTC'
you will get the behavior you expect.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan