Calendar TimeZone inDaylightTime returns incorrect answer for Israel

人走茶凉 提交于 2019-12-24 01:05:11

问题


Israel has recently changed its laws regarding DST such that when using the Calendar.getTimeZone().inDaylightTime(date) method, the response for the date range September 6th - October 27th is incorrect when deploying code to app engine. Interestingly when running on local dev server the range of dates that cause incorrect responses is different.

  1. Is there a short term workaround for this?
  2. What is the process for asking google to fix this?

回答1:


The change you describe is captured in the IANA TZDB release 2013d. You can see it in the commit history on GitHub here.

Since the code you showed looks like Java, I assume you are using the Java Runtime Environment on Google App Engine.

Java periodically updates their TZDB data and pushes it out via JRE updates. They do offer an out of band TZUpdater utility. You can read more about this here.

According to this changelog, the TZDB 2013d update is included in TZUpdater 1.3.57, but has not yet been merged into a JRE update release. You can download this for your local environment here.

Google would have to apply this TZUpdater to their production environment. I have searched, but I cannot find any information about whether they already do this regularly or not. You can raise an issue here to ask.

In regards to a workaround - you can use the Joda Time library, which has its own copy of the TZDB, and thus is not dependent on the JRE or TZUpdater update. Joda Time release 2.3 contains the 2013d data already, but if you wanted you could update it yourself, following these instructions. Of course, using Joda Time means significant changes to any existing code you may have, but it may be well worth the effort.



来源:https://stackoverflow.com/questions/18331994/calendar-timezone-indaylighttime-returns-incorrect-answer-for-israel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!