Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Date#===

d === other → bool

Returns true if they are the same day.

Example
Date.new(2001,2,3) === Date.new(2001,2,3)
                                  #=> true
Date.new(2001,2,3) === Date.new(2001,2,4)
                                  #=> false
DateTime.new(2001,2,3) === DateTime.new(2001,2,3,12)
                                  #=> true
DateTime.new(2001,2,3) === DateTime.new(2001,2,3,0,0,0,'+24:00')
                                  #=> true
DateTime.new(2001,2,3) === DateTime.new(2001,2,4,0,0,0,'+24:00')
                                  #=> false
See also #<=> #>> #<< #ajd also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0