Sending a date and timezone from GAE server to GWT client

前端 未结 2 2097
一向
一向 2020-12-31 22:18

OK folks, I have been going around this problem for about 2 weeks now trying everything I can think of and looking at tons of answers on here that feel like they are going t

相关标签:
2条回答
  • 2020-12-31 23:04

    I have a similar issue with v2.4.

    I think Riley Lark is right.

    TimeZone.createTimeZone("Asia/Tokyo") did not work in GWT 2.4

    However, I found I could get the Tokyo zone by using the browser's default setting via:

    Date d = new Date();
    TimeZone timezone = TimeZone.createTimeZone(d.getTimezoneOffset());
    

    That is really what Riley Lark is suggesting for you since europeLondon has "std_offset": 0...

    TimeZone timezone = TimeZone.createTimeZone(0);

    0 讨论(0)
  • 2020-12-31 23:05

    Have you tried, for example, TimeZone.createTimeZone("Europe/London");? At least in newer versions of GWT, this method accepts a whole bunch of names, evidently prepared "from CLDR and Olson time zone database[sic]". The documentation specifically references your use case: transferring timezone via json.

    See the properties file - it seems like it has all of the standard names for timezones.

    If that doesn't do it for you, you could transmit the offset of the timezone in minutes, and then create your timezone with TimeZone.createTimeZone(offsetInMinutes).

    0 讨论(0)
提交回复
热议问题