vicb / VisuGps3

Display GPS tracks on top of Google maps
MIT License
36 stars 13 forks source link

In chart, display hours according to browser timezone and daylight saving #14

Open TiTi opened 7 years ago

TiTi commented 7 years ago

It would be nice to display time according to current browser / OS settings so that users - especially those not used with the tool - are not induced in error. For instance:


Another example of software which does date formatting according to browser is Kibana (ElasticSearch viewer). See dateFormat:tz setting described at https://www.elastic.co/guide/en/kibana/5.4/advanced-options.html :

The timezone that Kibana uses. The default value of Browser uses the timezone detected by the browser.


I suppose its do-able by using something like that: -(new Date()).getTimezoneOffset()/60 around https://github.com/vicb/VisuGps3/blob/master/src/vgps3/plugins/chart/chart.js#L411

[Also need to update info panel with "[Th]" label]

I suppose we should be careful not to surprise users with such change, either by :

What do you think? Has it already been discussed?

vicb commented 7 years ago

That's a good idea.

Should not be too hard to implement - probably the server can check the time diff from the TO location and date.

TiTi commented 7 years ago

With the javascript code mentionned before, you don't even need to do something on the server side! (if you're sure the time is stored in utc)

It's best to use current browser setting than location of the path.

vicb commented 7 years ago

Why browser settings ? The local time is probably more interesting, no ?

On Thu, Jul 6, 2017, 11:50 Thibault ROHMER notifications@github.com wrote:

With the javascript code mentionned before, you don't even need to do something on the server side! (if you're sure the time is stored in utc)

It's best to use current browser setting than location of the path.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/vicb/VisuGps3/issues/14#issuecomment-313486008, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPL8kLm1Znt4n2ZNUC_sUgGj4n2QYiQks5sLSyFgaJpZM4OPmOw .

TiTi commented 7 years ago

Yeah when I mean browser settings I mean operating system settings, local time if you prefer ;) You don't have to do anything but use .getTimezoneOffset() in javascript.

I'll try to create a commit later

vicb commented 7 years ago

What happen if you look at a flight in the US from France ? Makes sense ?

On Thu, Jul 6, 2017, 12:17 Thibault ROHMER notifications@github.com wrote:

Yeah when I mean browser settings I mean operating system settings, local time if you prefer ;) You don't have to do anything but use .getTimezoneOffset() in javascript.

I'll try to create a commit later

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/vicb/VisuGps3/issues/14#issuecomment-313492742, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPL8mnefNjmitm8d0cGb7bIsG-SbA-oks5sLTKygaJpZM4OPmOw .

TiTi commented 7 years ago

With Kibana (which i'm familliar with), what happens is that you see dates as local time (french time in that case). For raw data with a date, it is pretty useful in order to understand when something happened [in the world].

But you're right, in case of a paraglider flight, we don't really need to know that a flight occured when it was 03:00 AM local time. We're interested about the sun, about the flight time in the context of a day of light. Thus the local time of the location of the flight is more interesting.

I agree, location of the flight is better than current browser timezone. But the code to get the timezone a little bit more complex. Maybe we can use an (server/client) API to get the timezone according to GPS coordinates? It looks like the Google Maps API can do it! https://developers.google.com/maps/documentation/timezone/intro

vicb commented 7 years ago

Makes sense - feel free to take a stab at it (I won't be available next week)

On Fri, Jul 7, 2017 at 2:45 PM Thibault ROHMER notifications@github.com wrote:

With Kibana (which i'm familliar with), what happens is that you see dates as local time (french time in that case). For raw data with a date, it is pretty useful in order to understand when something happened [in the world].

But you're right, in case of a paraglider flight, we don't really need to know that a flight occured when it was 03:00 AM local time. We're interested about the sun, about the flight time in the context of a day of light. Thus the local time of the location of the flight is more interesting.

I agree, location of the flight is better than current browser timezone. But the code to get the timezone a little bit more complex. Maybe we can use an (server/client) API to get the current timezone according to GPS coordinates? It looks like the Google Maps API can do it! https://developers.google.com/maps/documentation/timezone/intro

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/vicb/VisuGps3/issues/14#issuecomment-313800542, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPL8na7RUEWNoStnLuFh4hdR-gy5fWOks5sLqbhgaJpZM4OPmOw .

TiTi commented 7 years ago

I took a look at it. This is just keep you updated, no need to answer:

Got the dev. version working (vgps3.dev.html?track=victor.json).

I notice that time info. (label) is provided as text in the json response from the server, and the code is not on this github repository. For instance http://www.victorb.fr/visugps/visugps.html?track=http://parapente.ffvl.fr/trackserver/ffvl_igc_files-113645-1-raw.igc&... returns a JSON. Original server returns an IGC file. Neither proxy.php nor vg_proxy.php contain the code to generate the corresponding JSON. Samples are provided in tests\fixtures\tracks\json though.

I can see that JSON structure looks like:

{"time":{"label":["08h52","10h33","12h13","13h54","15h34"],"hour":[<entry for each point>],"min":[<entry for each point>], "sec":[<entry for each point>]}

In a first version, I'll try to do it in client-side (javascript) only, by parsing the label as UTC and getting location timezone of the first point from GMaps API. For now, I'm going to sleep :)

vicb commented 7 years ago

Server side code is in the visugps repo (w/o 3)

On Sun, Jul 9, 2017, 15:25 Thibault ROHMER notifications@github.com wrote:

I took a look at it. This is just keep you updated, no need to answer:

Got the dev. version working (vgps3.dev.html?track=victor.json).

I notice that time info. (label) is provided as text in the json response from the server, and the code is not on this github repository. For instance http://www.victorb.fr/visugps/visugps.html?track=http://parapente.ffvl.fr/trackserver/ffvl_igc_files-113645-1-raw.igc&... returns a JSON. Original server returns an IGC file. Neither proxy.php nor vg_proxy.php contain the code to generate the corresponding JSON. Samples are provided in tests\fixtures\tracks\json though.

I can see that JSON structure looks like:

{"time":{"label":["08h52","10h33","12h13","13h54","15h34"],"hour":[],"min":[], "sec":[]}

In a first version, I'll try to do it in client-side (javascript) only, by parsing the label as UTC and getting location timezone of the first point from GMaps API. For now, I'm going to sleep :)

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/vicb/VisuGps3/issues/14#issuecomment-313969628, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPL8osg_6N_AhyIAfITEzDjLECgdQeXks5sMVNrgaJpZM4OPmOw .