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.

Reply via email to