Rails: Date.parse mishandling spanish months

Created on 14 Dec 2016  路  3Comments  路  Source: rails/rails

Steps to reproduce

$ rails console:

2.3.0 :003 > Date.parse("01-Agosto-2016")
=> Thu, 01 Dec 2016
2.3.0 :004 > Date.parse("01-Abril-2016")
=> Thu, 01 Dec 2016

Expected behavior

2.3.0 :003 > Date.parse("01-Agosto-2016")
=> Mon, 01 Aug 2016
2.3.0 :004 > Date.parse("01-Abril-2016")
=> Xxx, 01 Apr 2016

Actual behavior

"Agosto" is parsed to December
"Abril" is parsed to December.

System configuration

Rails 5.0.0.1
Ruby 2.3.0

Would much like to fix this myself, should be straight forward, but I'm a hobby developer and have never contributed to a project.

third party issue

Most helpful comment

Great response time! Thanks. I'll take the issue to the correct place. Hope to make my first little contribution to open source.

All 3 comments

Date.parse is a Ruby method, not provided by Rails. As far as I can tell ActiveSupport doesn't affect it in any way. You'll have to take it up with Ruby.

As an aside, it does seem like Date.parse used to work with Spanish, but now it doesn't. Not sure when that changed.

馃憤 to @nateberkopec, Date#parse is a method provided by Ruby, not Rails. If you want to file an issue with the Ruby team, you can do so at https://bugs.ruby-lang.org/. Thank you for opening up this issue!

Great response time! Thanks. I'll take the issue to the correct place. Hope to make my first little contribution to open source.

Was this page helpful?
0 / 5 - 0 ratings