lib: Date.valid_date? returns incorrect response for negative day
require 'date' puts RUBY_VERSION if Date.valid_date?(2016, 2, -1) puts "Valid" else puts "Invalid" end
This reports 'Valid' for a negative day number.
Updated by zverok (Victor Shepelev) over 6 years ago
The month and the day of month should be a negative or a positive number (as a relative month/day from the end of year/month when negative). They should not be zero.
Date.new(2016,2,-1) # => #<Date: 2016-02-29 ((2457448j,0s,0n),+0s,2299161j)>
Returns true if the given calendar date is valid, and false if not.
The latter is pretty brief, yet I assume it means rather "valid params for Date.new" than anything else.