From: leemour@... Date: 2016-04-12T14:29:35+00:00 Subject: [ruby-core:74896] [Ruby trunk Bug#12273] Time.parse incorrectly parses Russian months Issue #12273 has been updated by Viacheslav Ptsarev. Victor Shepelev wrote: > I assume `Time.parse` is not localized to all world languages. > So, it just ignores the "unidentified" part, replacing it with "current month" (and then fixes non-existent 31.04 into 1.05): > > ~~~ruby > Time.parse('31 ������������ 2016') > # => 2016-05-01 00:00:00 +0300 > Time.parse('31') > # => 2016-05-01 00:00:00 +0300 > ~~~ Thanks. So what should I use to parse dates in Russian? ---------------------------------------- Bug #12273: Time.parse incorrectly parses Russian months https://bugs.ruby-lang.org/issues/12273#change-58022 * Author: Viacheslav Ptsarev * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.3.0 * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- When parsing dates in Russian where day number is 31, `Time.parse` returns `2016-05-01`. No matter what month or year is provided. 31 march 2016: ``` irb(main):003:0> require "time" => true irb(main):004:0> Time.parse "31 ���������� 2016" => 2016-05-01 00:00:00 +0300 irb(main):005:0> Time.parse "31 march 2016" => 2016-03-31 00:00:00 +0300 irb(main):006:0> Time.parse "31 mars 2016" => 2016-03-31 00:00:00 +0300 ``` 31 december 2013: ``` irb(main):013:0> Time.parse "31 �������������� 2013" => 2016-05-01 00:00:00 +0300 irb(main):014:0> Time.parse "31 december 2013" => 2013-12-31 00:00:00 +0400 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: