I appreciate your feedback, but respectfully suggest that you mis- apprehend the situation.
When I populate the data table at the server, google's java API requires that I convert my EST DateTime values to GMT --a reasonable requirement. Using google's client-side javascript API (response.getDataTable()), I have no control over the de-marshalling of the server-generated JSON, and the absolute GMT date is interpreted as EST relative --which is unreasonable-- and results in a skew of five hours (1.1.2011 12:00 EST at server -> 1.1.2011 17:00 GMT in server data table -> 1.1.2011 17:00 "EST" in client data table). Applying a timezone formatter to the DataTable yields another five hour skew (1.1.2011 22:00 "EST"). I don't understand Google's logic here. The client side interprets the time fields as an expression of local time, even though the data source convention stipulates time stamps be expressed in GMT. This is a bug or a design flaw, not a feature. The solution is to resolve the client-server miscommunication via one or both of the following: 1. re-work the client-side getDataTable() so it reads the GMT values as GMT values, 2. adjust the server as I suggested so it sends absolute timestamps, not relative ones. I modified my copy of the server-side library to send GMT milliseconds past epoch, thereby preventing the client-side from misinterpreting them. I hope google will make the necessary patch. Chris On Jan 9, 4:39 am, ChartALot <[email protected]> wrote: > Hi Chris, > > I looked at your issue carefully and the short answer is that the behavior > is intentional. To be more specific, the data source library does not treat > time zone differences in any way. This means that the data you placed in > your DateTimeValue object (e.g., 1.1.2011 12:00) will be presented in the > client side as is, without taking into account any timezone differences that > may appear between the data source and the client. > > The only gotcha that you may experience is when your client code tries to > use the date values. Since those values are expressed as JavaScript Date > objects, they carry the timezone of the client. You should ignore the > timezone and use only the values (Hour, Minute, Seconds, > etc.) > > Hope this helps. > > > > On Thu, Jan 6, 2011 at 5:23 PM, caparomula <[email protected]> wrote: > > Google's server-side java library requires that all DateValue objects > > added to a table be expressed in GMT. However, the rendered JSON sent > > to the client contains no timezone information, and the client-side > > response.getDataTable() call constructs new javascript Date objects > > using the local timezone. > > > A simple fix would be to have the JSON renderer generate a Date > > constructor that uses milliseconds past epoch instead of > > year,month,day,hour,minute,second. Not only would doing so resolve > > timezone discrepancies, but it would also significantly reduce the > > amount of text marshaled and de-marshaled. > > > For example, in > > com.google.visualization.datasource.render.JsonRenderer.appendCellJson(), > > use > > > case DATETIME: > > calendar = ((DateTimeValue) value).getCalendar(); > > valueJson.append("new Date("); > > valueJson.append(calendar.getTimeInMillis()); > > valueJson.append(")"); > > break; > > > instead of > > > case DATETIME: > > calendar = ((DateTimeValue) value).getCalendar(); > > valueJson.append("new Date("); > > > valueJson.append(calendar.get(GregorianCalendar.YEAR)).append(","); > > > valueJson.append(calendar.get(GregorianCalendar.MONTH)).append(","); > > > valueJson.append(calendar.get(GregorianCalendar.DAY_OF_MONTH)); > > valueJson.append(","); > > > valueJson.append(calendar.get(GregorianCalendar.HOUR_OF_DAY)); > > valueJson.append(","); > > > valueJson.append(calendar.get(GregorianCalendar.MINUTE)).append(","); > > valueJson.append(calendar.get(GregorianCalendar.SECOND)); > > valueJson.append(")"); > > break; > > > Chris > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Visualization API" group. > > To post to this group, send email to > > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<google-visualization- > > api%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-visualization-api?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
