The dates are being input via a Date object, so this issue isn't one with the API. The timezone issue is a side effect of the string-to-date conversion in Date objects. For some reason, the Date object assumes strings of the format 'yyyy-mm-dd' are in UTC format and not the local time zone.
I would recommend that you parse the date strings and build the date objects in the standard format to fix that:
for (var i = 0, plen = expectedValuePoints.length; plen > i; i++) {
var expected = Math.floor(expectedValuePoints[i].y);
var lower = Math.floor(lowerLimitPoints[i].y);
var upper = Math.floor(upperLimitPoints[i].y);
var dateArr = expectedValuePoints[i].x.split('-');
data.addRow([
new Date(parseInt(dateArr[0]), parseInt(dateArr[1]) - 1, parseInt(dateArr[2])),
lower,
expected - lower,
upper - expected
]);
}
On Thursday, September 27, 2012 6:01:50 PM UTC-4, Daniel LaLiberte wrote:
I would tend to consider it a bug because we are not being very robust about legitimate alternative date formats, though that is somewhat debatable.
There is also another bug concerning the end date and time zone. You'll note that in Firefox, the rightmost label on the horizontal-axis is missing (perhaps depending on where you are in the world), and this is because the January 1 date appears to be Dec 31 is some time zones. So there is a confusion about the time zone of your data vs the time zone of the viewer.
There are ways to work around these problems, but we have to decide how best to do that.
dan
On Thursday, 27 September 2012 21:01:24 UTC+2, trybka wrote:
You're quite right, it is the date parsing.
Your 2013 dates lack a leading zero on the month ('1' vs '01').
If you fix that, it will be parsed consistently with your other dates.
If I could kiss you now, I would! Thank you! And sorry for reporting this as a bug. I actually did try creating Date objects using Internet Explorer in Firebug Lite, since I thought that might be the bug, but I guess I was lucky with which date strings I tested (or unlucky, depending on your view)...
Big love to the internets
-
Carl-Erik
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/BSjS4bVWqUAJ.