Don
May 6, 2022, 8:25am
1
Hello,
I noticed the suspend and silenced warnings and emails contains wrong date. Sorry if I missed something about this.
Repro
Set up a (custom date and time) on suspend modal. I seted up a week suspend.
Set a reason and a custom email message
Click the suspend button
In the email it says until May 12, 2022 at 22:00
On the user card it shows until May 13, 2022 at 00:00
Same on admin page.
I think on the user card and admin the time should be 9:32 and in the email the date and time both wrong.
Thanks
3 Likes
I’ve been having a little play with this and there does seem to be some discrepancy between times/dates input and time/dates displayed.
For a suspension of 1 day (the pre-entered default):
And for a custom suspension of 1 week:
In both cases the email was an hour off, and any suspension longer than a day rounded out the time to midnight, and also knocked a day off the date in the email version.
Edit: Making sure I got all the right screenshots along the way clouded my thinking.
It’s because it’s knocking an hour off 00:00 which causes it to be a day early. So, it’s more about the lost hour between input and email. And @Don lost two.
3 Likes
andrei
(Andrei Prigorshnev)
May 24, 2022, 5:43pm
6
I can reproduce all problems. I’ll take a look at it.
3 Likes
andrei
(Andrei Prigorshnev)
May 25, 2022, 3:41pm
8
This fixes date in emails both when silencing and suspending users. Dates will be converted to user’s timezone:
discourse:main
← AndrewPrigorshnev:fix/respect-user-timezone-in-silencing-email
opened 03:37PM - 25 May 22 UTC
This fixes one of the problems reported in https://meta.discourse.org/t/wrong-cu… stom-date-and-time-in-silenced-and-suspended-warnings/226297/2.
When silencing or suspending a user, we send a date in UTC instead of sending a date in user's timezone, which is confusing.
For example a user in GMT+1 who was suspended until _8 May 2022 17:25_ will receive this email:
![aac0e0c441f8a516b244f3d30efa5c60cdeab65e](https://user-images.githubusercontent.com/1274517/170274510-61a4453d-c8e6-4bab-afb1-a334b700c879.png)
This PR fixes both silencing and suspending emails. Mails will be sent with date and time in user's timezone. If a user haven't set up timezone, dates will be sent in UTC.
Next we need to fix the rounding issue. I am looking at that.
3 Likes
andrei
(Andrei Prigorshnev)
May 27, 2022, 10:11am
10
The rounding bug was just fixed by @joffreyjaffeux in
discourse:main
← jjaffeux:future-date-input-time-lost
opened 09:40AM - 27 May 22 UTC
This also fixes the time part being lost when changing the date.
3 Likes
andrei
(Andrei Prigorshnev)
Closed
May 31, 2022, 4:00am
11
This topic was automatically closed after 3 days. New replies are no longer allowed.