Actions
Bug #9836
closedBad Implementation of Time.strptime
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Backport:
Description
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
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0