-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Behavior of days is different between Rails5.0 and 5.1 #30546
Labels
Comments
Related to #29163 ? |
I don't understand whether #29163 can solve this issue. But I think it is a close problem. |
Rails5.1.0 and 5.1.4 are equal to Rails5.1.3 |
Seems surprising to me: |
khall
added a commit
to khall/rails
that referenced
this issue
Oct 2, 2017
Previously durations could be divided and would return partial durations, but in Rails 5.1 dividing a duration such as 1.day / 2 would return a duration of 0 instead of 0.5 days. This change restores that functionality by forcing the divisor to a float, which allows for the partial duration to be returned. Also updated Duration::Scalar to behave the same way. Fixes rails#30546.
Is this still an issue in Rails 6.1? |
@ghiculescu, just tried using Rails 6.1.4.1: Loading development environment (Rails 6.1.4.1)
2.7.4 [1] » 1 / 2
=> 0
2.7.4 [2] » 1.day / 2
=> 43200 seconds
2.7.4 [3] » 1.0 / 2
=> 0.5
2.7.4 [4] » 1.0.day / 2
=> 0.5 days |
This seems fine as well
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
Results::
Rails5.1.4/5.1.3/5.1.0 => now
Rails5.0.2 => half a day ago
Expected behavior
Rails5.0.2
System configuration
Ruby 2.4.1
The text was updated successfully, but these errors were encountered: