Bad timezone for date in browser
I have a codebrag on a CentOS in the CEST timezone. My browser is in the CEST timezone too. And the date of commits and comments are wrong (shift of 2 hours).
It's because when my browser receive the commits (for example), the json is like this :
{"commit":[{"id":"xxx","repoName":"xxx","sha":"xxx"
,"message":"correction code propre\n\naddresses #14895\n\ngit-svn-id: http://xxx/svn
xxx@38455 a77b0ce4-d186-493e-baf1-5dd2f1cda47c\n","authorName":"xxx","authorEmail"
:"xxx@xxx","date":"2015-10-05T10:27:33Z","state":"AwaitingUserReview"
,"authorAvatarUrl":"xxx","reviewers"
:[]}],"older":0,"newer":0}
As you can see, the date is 2015-10-05T10:27:33Z. But it is wrong. The correct date should be this date in the CEST timezone (so GMT +2 during summer). So the browser javascript just shift the date of 2 hours at displaying.
Is there any workaround for this?
I didn't find it yet sorry.
I found a workaround, apparently the issue is when it's pulling the timestamp and inserting into the H2 database. I changed the server time to UTC and then reset the H2 database, after it did it's thing everything looked better.
Thanks for tip. I'll try it.
Yeah, the only workaround for now is to adjust server datetime. We don't translate time to user's timezone in browser as for now (but we probably should). I'll mark it as "to do" at some point, and as usual - PRs are welcome :)
Seems like the issue is that it is converting them incorrectly on the transfer from git to H2 as it processes incoming commits. The proper solution would probably be to store them correctly in UTC time in the H2 database and then convert based on timezone in the browser.