google / google-visualization-python

Automatically exported from code.google.com/p/google-visualization-python
Apache License 2.0
134 stars 53 forks source link

datetime timezone not applied correctly to js date object #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently if a python datetime object is given, an appropriate javascript
date object will be created as follows:
new Date(%d,%d,%d,%d,%d,%d)" % (value.year, value.month ....

Please note that this will be local time for the js date, which may not
match the python datetime object. I'd suggest converting to a
unix-timestamp and creating the js date from the timestamp instead. e.g.:
new Date(1252152000000)

Original issue reported on code.google.com by s.podkow...@gmail.com on 5 Sep 2009 at 1:33

GoogleCodeExporter commented 9 years ago
This is actually the expected/desired behavior.

In the vast majority of the cases, the user wants the datetime to look the same 
regardless in which timezone the viewer is. This can be done only with this 
constructor of Date in JS. Using the milliseconds constructor of Date in JS 
results in 
the local time which corresponds to the milliseconds for GMT. This is somehow 
more 
accurate as all viewers will get the exact same time however it will displayed 
differently.

Original comment by met...@gmail.com on 8 Sep 2009 at 11:18

GoogleCodeExporter commented 9 years ago
This may depend on case by case basis. However, theres a timeZone option in the
DateFormatter that can be used to make sure a particular TZ is used in the viz. 
I
haven't tried it, but I expect it won't work with the current behavior.

Original comment by s.podkow...@gmail.com on 8 Sep 2009 at 5:22

henrycjc commented 6 years ago

Can anyone provide an update on this issue?