Mosquito-Alert / Mosquito-Alert-Mobile-App

http://www.mosquitoalert.com
4 stars 3 forks source link

Localize datetimes #76

Closed epou closed 9 months ago

epou commented 9 months ago

@DigitalSeneca , any idea on how to show the datetime in the local time where the report was taken? That is, use the GPS information from the report to determine its Timezone and present the datetime in that specific local time. (only for views when listing reports and single report information)

If it's not easy, we can expose that info to the API.

epou commented 9 months ago

Hey! The 'Z' at the end of the datetime signifies "Zulu" timezones, equivalent to UTC. Initially, my idea was to showcase the local datetime based on the report's location. However, upon investigating Django's timezone handling, it appears that we can only store timezones in UTC in the database. If we intend to display the local time of the report location, we'll need to calculate it on the backend. We'll inform you whether we'll proceed with this approach or not. In the meantime, we'll go ahead with the .toLocal() option just to display the datetimes as it should after applying https://github.com/Mosquito-Alert/mosquito_alert/pull/181 into prod.