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
Incorrect values resulting from to_date on a Time object #5279
Comments
Not sure why this is, we looked around in the commits and found: f30fdfe#diff-c549944ab214525639bedaeffbaac520R61 It seems that the constant |
I run into date related problems on 9.2.0 recently. They were already fixed on master in my case and it looks like this one is ok too:
for reference, it's not exactly the latest, but close enough:
So the upcoming 9.2.1 should be ok.. |
@dr-itz Thanks for confirming it's fixed on master! We did do some rework of Date in 9.2. and some subsequent fixes in 9.2.1. |
I am getting this same exact issue on 9.2.14.0 (among other newer versions I also tried)
|
@nightsurge this is expected. If you call you may consider using
take a look at https://stevemorse.org/jcal/julian.html |
@ahorek when did this behavior change? We recently updated from Rails 4.1 to Rails 5.2, JRuby 9.1.15 to 9.2.14, and activerecord-jdbc-adapter to the 52-stable version. Prior to these updates, our database models would correctly translate the '0001-01-01' database value to the correct model attribute of a Date with Jan 1, 0001. I'm saying that when we do an ActiveRecord lookup I'm not even sure if this is a JRuby issue or something in ActiveModel/ActiveRecord, or JDBC Adapter... |
could you open a new issue? it looks more like a bug somewhere in it would be great if you could track where's the conversion being made, make a test case, or compare it with a different db adapter (on CRuby) |
I was able to track the change to the adapter when it moved to 50-stable and newer! That's when the gregorian calendar was put in place. I didn't "fix" it by checking for dates and handling pre-post gregorian, but I did make the fix for my scenario seen here: |
We were upgrading our environments to match JRuby 9.2.0.0 and noticed that calling
to_date
on Time objects lead to different results compared to previous iterations of JRuby and MRI.Environment
JRuby 9.2.0.0
Expected Behavior
JRuby 9.1.17.0
Ruby 2.3.3
Ruby 2.5.1
Actual Behavior
The text was updated successfully, but these errors were encountered: