From: sonots@... Date: 2016-04-19T01:25:31+00:00 Subject: [ruby-core:75018] [Ruby trunk Bug#12190] DateTime.strptime and Time.strptime does not have compatibility in terms of parsing timezone Issue #12190 has been updated by Naotoshi Seo. I verified that new codes cover all ZoneOffset which covered before with test codes https://github.com/ruby/ruby/pull/1297/files#diff-0bc90ed869793fffc539dfe705fa8facR443 This change should not break existing codes. (Of course, if someone expects that `Time.parse('2000-01-01T00:00:00 CET')` returns UTC timezone, such codes will be broken. But, I think such codes are already broken) ---------------------------------------- Bug #12190: DateTime.strptime and Time.strptime does not have compatibility in terms of parsing timezone https://bugs.ruby-lang.org/issues/12190#change-58147 * Author: Naotoshi Seo * Status: Closed * Priority: Normal * Assignee: * ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13] * Backport: 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED ---------------------------------------- For CET, only DateTime.strptime successfully parsed timezone ``` irb(main):003:0> DateTime.strptime('2015-11-12 CET', '%Y-%m-%d %Z') => # irb(main):004:0> Time.strptime('2015-11-12 CET', '%Y-%m-%d %Z') => 2015-11-12 00:00:00 +0900 ``` For JST also, only DateTime worked. ``` irb(main):005:0> ENV['TZ'] = 'UTC' => "UTC" irb(main):006:0> DateTime.strptime('2015-11-12 JST', '%Y-%m-%d %Z') => # irb(main):007:0> Time.strptime('2015-11-12 JST', '%Y-%m-%d %Z') => 2015-11-12 00:00:00 +0000 ``` For PST, both worked. ``` irb(main):004:0> DateTime.strptime('2015-11-12 PST', '%Y-%m-%d %Z') => # irb(main):003:0> Time.strptime('2015-11-12 PST', '%Y-%m-%d %Z') => 2015-11-12 00:00:00 -0800 ``` I felt DateTime.strptime and Time.strptime should have compatibility. -- https://bugs.ruby-lang.org/ Unsubscribe: