From 9f103e659ea9bff380f05bd5a85b9ca647fd8f88 Mon Sep 17 00:00:00 2001 From: tadf Date: Sun, 24 Apr 2011 18:07:24 +0000 Subject: * ext/date/lib/date/format.rb (_iso8601): added a pattern. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/date/lib/date/format.rb | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'ext/date') diff --git a/ext/date/lib/date/format.rb b/ext/date/lib/date/format.rb index b3dd1c4c62..cc4177a51c 100644 --- a/ext/date/lib/date/format.rb +++ b/ext/date/lib/date/format.rb @@ -209,7 +209,8 @@ class Date elsif /\A\s*(?:([-+]?(?:\d{4}|\d{2})|--)(\d{2})(\d{2})| ([-+]?(?:\d{4}|\d{2}))?(\d{3})| -(\d{3})| - (\d{4}|\d{2})?w(\d{2})(\d)) + (\d{4}|\d{2})?w(\d{2})(\d)| + -w-(\d)) (?:t? (\d{2})(\d{2})(?:(\d{2})(?:[,.](\d+))?)? (z|[-+]\d{2}(?:\d{2})?)?)?\s*\z/ix =~ str @@ -252,18 +253,22 @@ class Date end e[:cwyear] = y end + elsif $10 + e = { + :cwday => $10.to_i + } end - if $10 - e[:hour] = $10.to_i - e[:min] = $11.to_i - e[:sec] = $12.to_i if $12 - end - if $13 - e[:sec_fraction] = Rational($13.to_i, 10**$13.size) + if $11 + e[:hour] = $11.to_i + e[:min] = $12.to_i + e[:sec] = $13.to_i if $13 end if $14 - e[:zone] = $14 - e[:offset] = zone_to_diff($14) + e[:sec_fraction] = Rational($14.to_i, 10**$14.size) + end + if $15 + e[:zone] = $15 + e[:offset] = zone_to_diff($15) end e elsif /\A\s*(?:(\d{2}):(\d{2})(?::(\d{2})(?:[,.](\d+))?)? -- cgit v1.2.3