Topic timer has timezone issues

Topic timers seem to be off today. Setting a topic timer for “Later Today” (6 PM) should set a timer for 4 hours. It looks good when being set, but after the timer is set for 9 hours, or 11 PM. @sam is this what you were looking at yesterday in regards to “last day of the month”? @joffreyjaffeux is this related to select-kit? Looks like @eviltrout put in a fix. Doesn’t look like it’s working

Edit: This does not just affect later today. Even manually setting a topic timer is off. In my case it’s adding 5 hours, so setting a topic timer for Dec 1, 12:45 PM ends up being set for Dec 1, 5:45 PM. Perhaps we have an issue with local vs server time? I’m -5 UTC.

Can you repro @joffreyjaffeux? This used to work, yes? So maybe the shared component change is somehow causing the issue?

All the logic of dates has been untouched, so I doubt it, but will investigate as select-kit being involved somehow is the most probable cause.

What could happen is some state change of select-kit not being propagated correctly. It doesnt look like it’s the case here though…

1 Like

Actually I can’t reproduce.

“Later today” says “6pm” and then shows “This topic will automatically close in 9 hours.” given it’s 9am where I am, it’s expected.

3 Likes

For reference, it’s currently 9:45 AM local time,

I can still reproduce. In the topic timer “popup” everything looks OK. Selecting later today, 6 PM correctly says “8 hours” in the popup.

However, once I click Set Timer the text displayed below the topic now says 13 hours.


I have the same issue for other “times”. Here’s a manually selected time 1 hour ahead:

And here’s what I see after I set it:

3 Likes

Thx for the more detailed answer, I will look more closely, might a formating issue, once again this is weird as it’s displaying correctly in the edit-topic-timer component :man_shrugging:

This was reported as a bug by a big customer of ours recently. They’d use the dropdown (in admin / suspend) to suspend a user until the next day at 6pm, but immediately after saving it the date was wrong. My fix was to include the timezone Z in the date format and it seemed to work.

I’d assumed it was a regression with select-box-kit but I did not confirm that, and now I’m wondering if my fix broke it elsewhere?

2 Likes

Can you point me the commit and the initial bug report? I will try to revert it and add tests

Here’s the commit for the fix. Not sure where the original report is.
https://github.com/discourse/discourse/commit/23ee3047bfc32d5a6d72ec699db8e0d5cc00b466

2 Likes

ok ok finishing something about polls and I will investigate all of this.

2 Likes

I have submitted a PR for this issue, if you are interested in, there are more details in the PR description.

https://github.com/discourse/discourse/pull/5398

Fix has been double checked and looks good!

7 Likes