tripleblindai / safe-places

Healthcare Tools built on top of Private Kit and COVID Safe Paths
MIT License
34 stars 40 forks source link

Saint Lucia HA reported timestamp / timezone bug #65

Open kylemtowle opened 4 years ago

kylemtowle commented 4 years ago

Saint Lucia reports that the unix timestamps are off by 3 hours from local time when they load the GPS data into the redaction tool.

kylemtowle commented 4 years ago

[{"latitude":14.08051832,"longitude":-60.94727734,"time":1587332801000},{"latitude":14.08815485,"longitude":-60.95036579,"time":1587333447000},{"latitude":14.0896572,"longitude":-60.95411059,"time":1587333749000}]

safe_paths_screenshot_for_kyle

kylemtowle commented 4 years ago

Hey Kyle;

It was great speaking to you today as well. The error seems to be in the Safe Places Redaction Tool. I have attached a screenshot and the supporting json file. It is off by 3 hrs. I wrote some code to show what it should look like and I have pasted it at the bottom of the screenshot.to show show you what it should say. I was at the location at 6pm yesterday and it shows 3pm. Happy to assist.

Regards Jim

mundanelunacy commented 4 years ago

Any chance we can have the file shown in the screenshot above?

kylemtowle commented 4 years ago

Not sure which file you are referring to...

mundanelunacy commented 4 years ago

The json file Jim loaded on the redaction tool

kylemtowle commented 4 years ago

How does the MAPS API convert these timestamps to local time zone? The unix timestamps are in GMT and are correct, they just need to be converted to the local time zone. In the example above they look to be converted to PST..

mundanelunacy commented 4 years ago

Happens here: https://github.com/tripleblindmarket/safe-places/blob/develop/js/location-scrubber.js#L266

From this SO article looks like .toLocaleString() is getting Jim's timezone from his system user settings.

Could be that the TZ on Jim's computer is set to PST or he is using a browser flavor that doesn't implement .toLocalString() correctly.

AFIK, there are three ways to get Times to display with the correct Timezone (none of which are great)

  1. Have an on-screen UI element where user selects his TZ
  2. Use a service to reverse GeoCode the IP to infer the TZ (e.g. maxmind)
  3. Display all times in GMT and call it a day

How mission critical is this bug in getting early traction? Option 1 and 2 look like solid requirements for dev_react. Could potentially be time-consuming for MVP