# Topic timer has timezone issues

**URL:** https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110
**Category:** Bug
**Tags:** topic-timers
**Created:** [November 30, 2017, 6:59pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110 "2017-11-30T18:59:43Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [November 30, 2017, 6:59pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/1 "2017-11-30T18:59:43Z")

</div>

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”? @j.jaffeux is this related to select-kit?~~ Looks like @eviltrout put in [a fix](https://github.com/discourse/discourse/commit/23ee3047bfc32d5a6d72ec699db8e0d5cc00b466). Doesn’t look like it’s working

[https://global.discourse-cdn.com/meta/original/3X/2/8/28060d096434b7fdbd1b1cb4a76bdbc775e88535.mp4](https://global.discourse-cdn.com/meta/original/3X/2/8/28060d096434b7fdbd1b1cb4a76bdbc775e88535.mp4)

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 1, 2017, 7:58am UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/2 "2017-12-01T07:58:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 1, 2017, 7:59am UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/3 "2017-12-01T07:59:52Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 1, 2017, 8:13am UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/4 "2017-12-01T08:13:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [December 1, 2017, 2:47pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/5 "2017-12-01T14:47:52Z")

</div>

_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.

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/7/575dec6dc4d2e9bff91b696ee11a2832b8821d04.png)

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/c/8c9b393ca055813335c216fb4f0c0de0b12ad773.png)

* * *

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/9/79675e8e69928b1a8cb4fcd55edaae5902af22ad.png)

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/d/8d140c62cc5002a2ba3e9a19ced1a9d8c47d5b2b.png)

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 1, 2017, 2:52pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/6 "2017-12-01T14:52:46Z")

</div>

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 🤷‍♂️

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [December 1, 2017, 2:58pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/7 "2017-12-01T14:58:42Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 1, 2017, 2:59pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/8 "2017-12-01T14:59:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [December 1, 2017, 3:00pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/9 "2017-12-01T15:00:31Z")

</div>

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

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 1, 2017, 3:08pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/10 "2017-12-01T15:08:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 5, 2017, 3:18pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/12 "2017-12-05T15:18:43Z")

</div>

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](https://github.com/discourse/discourse/pull/5398)

Fix has been double checked and looks good!

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 7, 2017, 11:21pm UTC](https://meta.discourse.org/t/topic-timer-has-timezone-issues/75110/17 "2017-12-07T23:21:16Z")

</div>


