Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Time#to_datetime incorrect for times before the date of calendar reform #4822
jruby 22.214.171.124 (2.3.3) 2017-09-06 8e1c115 OpenJDK 64-Bit Server VM 25.144-b01 on 1.8.0_144-b01 +jit [OpenBSD-x86_64]
Also tested on:
jruby 126.96.36.199 (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.131-b11 on 1.8.0_131-b11 +jit [mswin32-x86_64]
Same Results as CRuby for the following code:
require 'date' # after date of calendar reform in 1582: correct p Time.at(-12000000000).utc p Time.at(-12000000000).utc.to_datetime # before date of calendar reform in 1582: incorrect p Time.at(-12500000000).utc p Time.at(-12500000000).utc.to_datetime
Note the change from
Hmm actually this logic is mostly contained in date.rb, which does already use the Gregorian/Julian chronology by default.
My patch to modify RubyTime in a similar way did not appear to help: https://gist.github.com/headius/6ee8683674d1c38a330b1a6c7bc7d5f6
Ok interestingly enough, if I modify our date library to use ISO chronology, we match MRI.
So I'm not sure who's right now.