How to set the Discourse Timezone


(William Chambers) #1

I’ve been running a forum for about year as a testbed and when I set it up I was using EST for the server time. Now that I’m opening it up to a much more international community I wanted to set it to UTC to prevent confusion when discussing times of posts. I already changed the server time, but it doesn’t appear to be reflected in Discourse.

Is there a setting I have to change or is it already doing trickery to make it look like the right time and I don’t need to worry about it further? Thanks for the help!


#2

(Allen - Watchman Monitoring) #3

Have you rebuilt since you changed the server time?

Also, where are you looking to see the current timezone?


(William Chambers) #4

I have indeed. I’ve double checked the application.rb file which is set to UTC still and the server time is UTC as well. I made a test thread here.

Could it just be some JS trickery that is polling the browser for a timezone? I don’t have an easy way to test for that right now.


(Jeff Atwood) #5

Server time will only matter for server logs, the user will always see their local time in the web browser.


(William Chambers) #6

Fair enough, that’s a pretty sane default. Thanks for the update. :slight_smile:


(Happy Lee) #7

Hi - I’m attempting to change the default timezone for Discourse, and have found the thread that shows where to make the change. However, I cannot find this file in my filesystem.

In a default installation of Discourse (root: /var/discourse and /var/lib/docker) where is the “application.rb” file located? I could not use find to discover this file.


#8

That line of code only changes the server time, and it does not affect what the user sees:

What’s your use case here, maybe we can help you find a suitable solution?


BTW, It’s highly recommended that you do not modify Discourse’s source code directly in production:


(Happy Lee) #9

I am certainly not inclined to incur more work and risk for myself by changing source code, but here, we see the timezone of the application affects more than just the server logs.

The case is this: When someone posts a topic, the posting time (shown in the Activity Summary) is 7 hours later than actual time. Example: In the Activity Summary the topic posting time is Oct 3rd, 3:04AM, but when you go to the Discourse website - the user posted the topic Oct. 2nd at 8:04PM. My timezone is PDT, and the app seems to be in UTC.

Has anyone else observed this, or know the best way to correct it?

Website:

Activity Summary:


#10

I think this is a #bug.

I could be wrong, but I believe Discourse cannot convert server time to local time in emails, due to not having the concept of user timezones. FWIW changing the application timezone will only “fix” it for the users in that particular timezone.

All emails I have received from Discourse so far only includes the date, i.e. October 3, and TBH I haven’t been attentive enough to notice the potential off-by-one errors. Maybe the activity summary emails should be changed to do that as well?