-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add iana timezone database support to js-joda #32
Comments
@pithu has there been any progress on this issue so far? |
Beside a "proof of concept", unfortunately no. It is not to much to do, but i did not find the time. Mainly this things are still missing
A colleague of mine came up with a proof of concept for wrapping the moment timezone code. He reports that it works fine for his case, but of course, it is just a quick hack. find the code in the this gist https://gist.github.com/pithu/23128485d022af27a5b36b3fbbf6d92e |
Just FYI - you might want to look at moment/moment#3134. This is Tim cleaning up the way moment timezone does timezone adjustments in the moment core library. We haven't decided for sure to move forward on this because a lot of libraries depend on moment and there's some concern about breakage. I think we will though, as it really helps the code. Inherently, if you could support this same interface, you might be able to run moment-timezone right on top of what you have. I haven't thought very hard about this for your use case though, so I could be totally wrong. |
Hello @maggiepint, thank you for your answer. My idea of implementing js-joda iana tzdb is to implement it conform to the threeten API and just use a small part from moment-timezone: the packed data json file containing the iana tzdb and the code to unpack it. So in opposite to code of the gist above, we will depend only very little to moment-timezone. As soon as we have some more concrete ideas, it would be great to discuss it with you and to match it with your future plans. |
By releasing js-joda@v1.1.12 we made the next step towards timezone support. 1.1.12 implement/ complete/ fixes the handling of daylight transition edge case. The ZoneProvider and the iana tzdb are still missing |
Given that IANA support is still pending, I assume that there is currently no way to parse a string like this: Is that correct? -- If so, do you have a timeframe when this feature will be available? |
Hello @DanielSWolf yes, correct, parsing of ZoneRegions as supplied in iana tzdb is currently not working. We are currently about to refine our plugin/ module separation logic and i pushed a first very early version of https://github.com/js-joda/js-joda-timezone today, just containing a stub. After implementing the the two moment adapter classes (provider and rules) at js-joda-timezone, zone-id calculation should work out of the box, eg. But unfortunately i cant promise you any timeframe |
For parsing ZoneRegions we have to migrate some more code in the DateTimeFormatterBuilder-> https://github.com/ThreeTen/threetenbp/blob/456f648b4e02ace2998bf8aa2ba6e3412eaa83e0/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L3491-L3529 |
We recently published a pre-release of js-joda-timezone@0.0.5, together with the latest js-joda release the most common timezone functionality of the core library is working quite well, like parsing and converting to other timezones.
But there are still known issues, like calculations during gap/ overlap of a daylight transition might be incorrect, test coverage is low and there is some space for performance optimization. |
According to the Roadmap section of the README.md in this repo, this is already achieved as of v1.2. Is that documentation incorrect, or is the v1.2 implementation safe for production use? |
Hello @jrnail23, thx for using js-joda. Yes, js-joda v1.2 is production ready. But for iana tzdb support you need the zone rule provider https://github.com/js-joda/js-joda-timezone, the package has a pre-release version only, with some minor issues (see Readme.md). It should work for the most use cases, just when converting a LocalDateTime in a daylight saving gap/ overlap transition, it might add the offset in the wrong direction. The issues are easy to fix and i will release a production ready version of js-joda-timezone in a couple of weeks. |
Mission complete!!! We just released js-joda-timezone@1.0.0 that provides full iana tzdb support for js-joda@1.3. 🍾 🍾 🍾 🍾 🍾 |
👍👏 |
Congrats! The Moment team also applauds your efforts. 👍 |
Great stuff. Really appreciate the effort. 👍 |
Thanks for the flowers and thanks to the moment team for providing the compact json format of the timezone information's. It saves us a lot of time. btw: js-joda-time just depends on the moment json files and the packed format. We copied the code for unpacking from the moment-timezone es6 branch. @maggiepint do you know if there are any plans to change the format in the future? |
This issue is the place to discuss and plan the feature "iana tz db support" for js-joda.
The iana Time Zone Database contains data that represent the history of local time around the globe and is coordinated by the Internet Assigned Numbers Authority (IANA). The latest version of the database is provided at https://www.iana.org/time-zones.
js-joda already implements the core class for zone based date time values, ZonedDateTime, but with support for fixed zone offsets and the system default zone only. Not yet ported is the code for daylight saving transitions, compiling, compressing and providing the zone rules.
It might be not necessary to port the threeten code for compiling and compressing the tz db but instead use parts of the code of the moment timezone project http://momentjs.com/timezone/.
The text was updated successfully, but these errors were encountered: