adhocracy icon indicating copy to clipboard operation
adhocracy copied to clipboard

Show correct user timezone

Open nidico opened this issue 12 years ago • 2 comments

Adhocracy currently uses the server time (which is usually UTC on Linux machines) to store and display activity information. There is no way to change the displayed time zone - neither on an installation or instance, nor on a user base.

Generally it makes sense to set the time zone on all three levels:

  • Installation wide - which is then the server default.
  • Instance wide - overwriting the server default (think adhocracy.de)
  • On a user base - overwriting server and instance setting

After the discussion below, the following two items need to be done:

  • [x] Allow installation-wide timezone configuration
  • [ ] Dynamically replace the shown timezone with browser setting

Note: This issue has been automatically migrated from Bitbucket Created by @nidico on 2012-07-01 22:38:36+00:00, last updated: 2012-07-05 13:25:06+00:00

nidico avatar Sep 24 '12 05:09 nidico

(Reply via [email protected]):

I think that would be good in general, but also complex.

A simpler alternative is to always display the dates in the users time zone via javascript. There is a time element and a datetime attribute in html (5) which does that. adhocracy.i18n.relative_time() spits it out:

<time datetime=3D"1999-11-11T11:55:00">1999-11-11T11:55:00

Some of the javascript is able to turn that in something human friendly. I think it's "11 minutes ago" or "yesterday".

The Text content of the time element is not much relevant here, so it could be more readable, and the javascript could recognize the timezone of the computer and adjust the display to that (given the datetime attribute contains UTC time). That's (almost) always what the user wants (tm). Detecting the users time zone on the server side is AFAIK not nearly as reliable.

The hippest kit on the javascript block currently is moment.js [1] and it is quite feature rich and supports internationalization and localizati= on.

[1] http://momentjs.com/

Note: This comment has been automatically migrated from Bitbucket Created by @csenger on 2012-07-02 07:45:05+00:00

nidico avatar Sep 24 '12 05:09 nidico

Doing that stuff on client side - why not - simplifies things indeed.

To me, 4.3kB and another 2 HTTP requests (one for i18n) sound quite a lot for what we want from it, on the other hand, we get all the fancy stuff for free, so be it :)

For those without Javascript, I propose to still do an installation wide timezone setting, which determines the text part of the time element. This should then contain the timezone information, e.g. "20.12.2012 (GMT+1)", or - less technical - "20.12.2012 (Berlin time)", where "Berlin" is another config setting "adhocracy.timezone.location".

Note: This comment has been automatically migrated from Bitbucket Created by @nidico on 2012-07-05 13:25:06+00:00

nidico avatar Sep 24 '12 05:09 nidico