Discourse calendar events are not displaying in local timezone


(Guido Drehsen) #1

great feature, today I did activate it for the staff in our installation.
But it looks like the calendar is using UTC whereas our default timezone is Europe/Berlin, so currently UTC +2

Therefore when adding an entry it is shown correctly in the post:
image

But in the staff calendar it is then shown as 2 am today until 1.59 am tomorrow:

image

Is there a way that the calendar does also use the default timezone?


Discourse Calendar
(Jeff Atwood) #2

Servers should always be in UTC. That is a fundamental assumption.


#3

This is all Greek to me.

Do you mean the Linux server should be set to UTC 0 regardless of the server’s physical location? If so, please elaborate.


(Jay Pfaffman) #4

Yes. Unix servers, airplanes and submarines all have their clocks set to UTC.


(Stephen) #5

It doesn’t mean you can’t have the time zone set on the server, in fact it’s assumed that you have both set the time in UTC and configured time zone data.

If you don’t have a clock set to UTC it will cause all kinds of pain when you get to implement stuff like SSL.


(Sam Saffron) #6

Curious, is this a docker install, as long as it is we can hard force the time zone in the container


#7

This is what I see on my Discourse server (DO Droplet):

timedatectl | grep zone
Timezone: America/New_York (EDT, -0400)

Does this need to be “fixed”? If so, how?


(Vinoth Kannan) #8

I’m not sure about Linux’s default timezone. But I think I could fix the issue in calendar plugin itself. Let me have a look.


(Guido Drehsen) #9

well server time is of course UTC but the time zone of the linux server is UTC+2 Europe/Berlin
And I am talking about the calendar. For a server with worldwide employees it might eventually make sense to show everything in UTC, even though I think the calendar should show the times depending on the users local time zone.

yes it is a docker install on a linux server which is also set up with time zone Europe/Berlin (UTC +2)

thanks for having a look at it.


(Vinoth Kannan) #10

This is fixed now. @GuidoD can you please test it again? You should rebake / edit your old posts to see the changes.


(Guido Drehsen) #11

sorry to say but it looks like nothing did change.
I pulled via admin/upgrade the new discourse-calendar (456f1bc) and it got installed.

But rebake/edit did not help, I even made a new calendar with a new entry but it does still look the same.
Did I made something wrong?

image


(Vinoth Kannan) #12

I think you are not in the latest version of Discourse. Recently I did many changes and fixes in “discourse-local-dates” plugin too. I can confirm it is working correctly in my sandbox. I’m getting below time range in my new calendar topic for your above example input.

ber-ist (GMT+5:30 = IST)


(Guido Drehsen) #13

well I am on the latest version.
Your screenshot does show exactly what mine did also show, so the calendar itself does always show everything in UTC (yours does show 3:30-3:29 for UTC+5:30 and mine did show 2:00-1:59 for UTC+2 :wink:

But ok, I understood now that the calendar itself is always based on UTC and not on the local time zone and that the entries in the calendar are shown in correlation to their time zone, so also always in UTC.

I will just have to inform my staff members, that the calendar does not show the local time but instead UTC and that therefor current all days entries are shown as 2:00-1:59 and starting end of this month with the end of the daylight saving time will be show as 1:00-0:59


(Vinoth Kannan) #14

I don’t think so. For me [date=2018-10-17 time=00:00:00 timezone="Europe/Berlin" format="LL" timezones="Europe/Berlin"] is converted 3:30a in the calendar. So if you’re in UTC+2 it shouldn’t display 2a. In short it should have same date and time which displaying in the corresponding post. Can you please try again in a different new topic and post.

Else I will wait for more reports from other users to make sure the issue exists.


(Guido Drehsen) #17

very interesting, I just tried it again and now it is shown correctly.
So thanks for your fix, it looks fine now. :slight_smile:

image

image

image


(Sam Saffron) #18