Issue #14102 has been reported by cyclotron3k (A Samuel).

----------------------------------------
Bug #14102: Date.strptime ignores constraints provided by day name
https://bugs.ruby-lang.org/issues/14102

* Author: cyclotron3k (A Samuel)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.2
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
~~~ ruby
RUBY_VERSION
=> "2.4.2" # also tested in 2.5.0

require 'date'
=> true

Date.strptime('Potato, November 13, 2017', '%A, %B %d, %Y').strftime('%A, %B %d, %Y')
=> ArgumentError: invalid date

Date.strptime('Friday, November 31, 2017', '%A, %B %d, %Y').strftime('%A, %B %d, %Y')
=> ArgumentError: invalid date

# November 13, 2017 is a Monday
Date.strptime('Tuesday, November 13, 2017', '%A, %B %d, %Y').strftime('%A, %B %d, %Y')
=> "Monday, November 13, 2017"

~~~

None of the dates above are valid, only one gets coerced.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>