cfdp / opeka

Counseling chat service, built for providing anonymous help to young people at risk
https://curachat.com
GNU General Public License v3.0
10 stars 6 forks source link

Invite list does not list the correct chat date and time #100

Closed benjamin-dk closed 7 years ago

benjamin-dk commented 7 years ago

The Date & Time column on the /admin/opeka#invites path is not displaying the correct time on the production server. It is consistently two hours behind the time we set in the time field on the invitation form.

It is probably related to the fact that the production server is located in Iceland and is running on the local time there, which is two hours behind Danish time.

benjamin-dk commented 7 years ago

@alex-bukach do you have a suggestion how to fix this?

alex-bukach commented 7 years ago

@benjamin-dk does it display the time correctly at /admin/reports/opeka-invites?

alex-bukach commented 7 years ago

@benjamin-dk nevermind, I see the issue. I will fix it.

benjamin-dk commented 7 years ago

@alex-bukach yes on the reports page the time is correct on /admin/reports/opeka-invites - sorry for the misleading title of the issue.

alex-bukach commented 7 years ago

@benjamin-dk fixed in https://github.com/cfdp/opeka/pull/101.

When a user saves a date, Drupal thinks the date is indicated in the user's timezone (or site timezone if users are not allowed to set own timezones). Thus Drupal converts it to timestamp (i.e. roughly speaking converts it to UTC time). Now, when showing the date&time at /admin/reports/opeka-invites, Drupal converts it back to a user timezone, and it displays properly.

However at /admin/opeka#invites it is nodejs that converts the time, and it uses server timezone, not Drupal user/site timezone. Thus if that two timezones were different, the value displayed at /admin/opeka#invites was incorrect.

Now I moved formatting date&time to client side and passed current Drupal user timezone there, so that it has a proper value. Also it allowed to translate the date to the user language there.