From: zverok.offline@... Date: 2016-03-18T13:24:10+00:00 Subject: [ruby-core:74455] [Ruby trunk Bug#12196] lib: Date.valid_date? returns incorrect response for negative day Issue #12196 has been updated by Victor Shepelev. From `Date::new` docs: > 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. ~~~ruby Date.new(2016,2,-1) # => # ~~~ From `Date.valid_date?` docs: > 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. ---------------------------------------- Bug #12196: lib: Date.valid_date? returns incorrect response for negative day https://bugs.ruby-lang.org/issues/12196#change-57575 * Author: Daniel Doherty * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.2.2 * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- ~~~ 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. -- https://bugs.ruby-lang.org/ Unsubscribe: