joda-time icon indicating copy to clipboard operation
joda-time copied to clipboard

Using JVM time zone rules in Joda

Open haozhun opened this issue 7 years ago • 2 comments

I understand that this is not something that Joda can provide because Joda cannot depend on java.time. I'm writing this issue for two reasons:

  1. I would like comments from @jodastephen about the implementation, both from correctness and performance perspective.
  2. I understand that I'm not the first one that has wanted to do this. But I can't find any one who did this successfully. I would like my code be available to others.

https://gist.github.com/haozhun/f73e0c73a2dcc816c752d101b3513ce1

I understand that this is something more suitable for something like a mailing list than an issue. However, the only I can find is from SourceForge, which is likely obsolete.

haozhun avatar Nov 10 '18 02:11 haozhun

I made some changes to the code I originally posted here. The only significant change is that all zones are initiated ahead of time (instead of using a cache). For my use case, the simplicity is worth it over the performance.

Updated code is here: https://github.com/airlift/joda-to-java-time-bridge

Your comment would be greatly appreciated.

haozhun avatar Dec 20 '18 01:12 haozhun

This looks pretty good to me. In an ideal world, it would be nice to have a Java 8 version of Joda-Time that aids the transition to java.time.*, but it isn't easy to find the time.

I'll leave this open to aid others in finding the code.

jodastephen avatar Jan 14 '19 22:01 jodastephen