summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-24 18:07:24 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-24 18:07:24 +0000
commit9f103e659ea9bff380f05bd5a85b9ca647fd8f88 (patch)
tree5900b7bd5b4cc484315863aeb7debc74a4877b10 /ext/date
parentf3551c047645a381ae306d4592ca60a0ca602f66 (diff)
* 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
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/lib/date/format.rb25
1 files changed, 15 insertions, 10 deletions
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+))?)?