Actions
Bug #21147
closed[Breaking changes or Bug] DateTime Range#to_a behaves different between 3.3.7 and 3.4.1
    Bug #21147:
    [Breaking changes or Bug] DateTime Range#to_a behaves different between 3.3.7 and 3.4.1
  
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.7 (2025-01-15 revision be31f993d7) [arm64-darwin24], ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]
Description
a = Time.zone.now.to_date
b = Time.zone.now.to_date
# Ruby 3.3.7
(a..b).to_a
=> [Tue, 18 Feb 2025] 
# Ruby 3.4.1
(a..b).to_a
=> [] 
        
           Updated by jamesst20 (James St-Pierre) 8 months ago
          Updated by jamesst20 (James St-Pierre) 8 months ago
          
          
        
        
      
      Sorry, the exemple above is incorrect.
Pure Ruby reproductible
require 'date'
require 'json'
a = Time.now.to_date
# Ruby 3.3.7
(a..a).step(7).to_a
# => [Tue, 18 Feb 2025]
# Ruby 3.4.1
(a..a).step(7).to_a
# => []
        
           Updated by mame (Yusuke Endoh) 8 months ago
          Updated by mame (Yusuke Endoh) 8 months ago
          
          
        
        
      
      - Related to Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 added
        
           Updated by mame (Yusuke Endoh) 8 months ago
          Updated by mame (Yusuke Endoh) 8 months ago
          
          
        
        
      
      - Status changed from Open to Closed
I think it is already fixed by #21030 and backported to ruby_3_4 branch. Please wait for the next release of 3.4 series
Actions