From: "jeremyevans0 (Jeremy Evans) via ruby-core" Date: 2026-11-10T06:39:12+00:00 Subject: [ruby-core:127400] [Ruby Feature#22530] Deprecate fractional day support for Date Issue #22530 has been reported by jeremyevans0 (Jeremy Evans). ---------------------------------------- Feature #22530: Deprecate fractional day support for Date https://bugs.ruby-lang.org/issues/22530 * Author: jeremyevans0 (Jeremy Evans) * Status: Open ---------------------------------------- I think we should deprecate fractional day support in Date. This has been discussed in #21264 as well as in the PR to convert from the current C implementation to a Ruby implementation (https://github.com/ruby/date/pull/155#pullrequestreview-5639933517). At least @eregon and @rhenium have also indicated support for dropping it. @matz commented on the PR (https://github.com/ruby/date/pull/155#issuecomment-6757669093) stating that we should have a separate ticket for this, which is why I'm opening this ticket. Here's how fractional day support currently works: ```ruby d1 = Date.new(2000, 1, 2) # => # d2 = Date.new(2000, 1, 2.5r) # => # d1 = d2 # => true d3 = d1 + 0.5r # => # d3 == d1 # => false d4 = d3 + 0.5r # => # ``` Basically, fractional days are ignored in the constructors, but are respected by `+` and `-`. This behavior doesn't really make sense. I assume the only reason this choice was made historically was the Date and DateTime implementations were shared, and it was easier to have the same behavior for both, even though the behavior for Date makes no sense. In terms of deprecating fractional days, I propose we deprecate this in the C implementation released in Ruby 4.1. Hopefully by Ruby 4.2, the Ruby implementation of date will fix the remaining issues and we can merge it. This approach avoids complicating the Ruby implementation of Date. I've submitted a PR to date for the deprecation: https://github.com/ruby/date/pull/201 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/