From: silverhammermba+ruby@... Date: 2014-05-14T19:14:19+00:00 Subject: [ruby-core:62589] [ruby-trunk - Bug #9836] Bad Implementation of Time.strptime Issue #9836 has been updated by Max Anselm. Sorry for the unclear wording. I would expect that it behaves similar to `DateTime`'s implementation and to not ignore any fields returned by `Date._strptime`. At the very least the documentation should reflect the fact that it will only use certain values when constructing the `Time` object. ---------------------------------------- Bug #9836: Bad Implementation of Time.strptime https://bugs.ruby-lang.org/issues/9836#change-46733 * Author: Max Anselm * Status: Feedback * Priority: Normal * Assignee: * Category: * Target version: * ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- According to the documentation, `Time.strptime` "parses +date+ using `Date._strptime` and converts it to a Time object." However this conversion is extremely naive, using only certain fields return by `Date._strptime` and ignoring the rest (for example `:wnum0`). This creates confusing and inconsistent behavior when compared to `Date` and `DateTime`'s `strptime` methods. For example: ``` puts Date.strptime('201418', "%Y%U") => 2014-05-04 puts DateTime.strptime('201418', "%Y%U") => 2014-05-04T00:00:00+00:00 puts Time.strptime('201418', "%Y%U") => 2014-01-01 00:00:00 -0500 ``` -- https://bugs.ruby-lang.org/