summaryrefslogtreecommitdiff
path: root/lib/date
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-19 01:29:21 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-19 01:29:21 +0000
commitb9ff18fa6e7e7fd6443cede024e38f46b8a9932e (patch)
tree92604784d919839e6a3341c53124feb48f0c5234 /lib/date
parent7313b14021413a38f49d26da8640571e52220fc3 (diff)
* lib/date/format.rb (Date._parse): detects some OFX dates
(Of course not fully). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/date')
-rw-r--r--lib/date/format.rb21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/date/format.rb b/lib/date/format.rb
index c86fc74291..4e2818f24e 100644
--- a/lib/date/format.rb
+++ b/lib/date/format.rb
@@ -1,5 +1,5 @@
# format.rb: Written by Tadayoshi Funaba 1999-2007
-# $Id: format.rb,v 2.34 2007-05-08 21:17:02+09 tadf Exp $
+# $Id: format.rb,v 2.35 2007-05-19 09:23:48+09 tadf Exp $
require 'rational'
@@ -871,7 +871,7 @@ class Date
end
def self._parse_dot(str, e) # :nodoc:
- if str.sub!(%r|('?-?\d+)\.\s*('?\d+)[^-+\d]\s*('?-?\d+)|n, ' ') # '
+ if str.sub!(%r|('?-?\d+)\.\s*('?\d+)\.\s*('?-?\d+)|n, ' ') # '
s3e(e, $1, $2, $3)
true
end
@@ -910,11 +910,12 @@ class Date
(?:
\s*
(
- Z
+ Z\b
|
- [-+]\d{1,4}
+ [-+]\d{1,4}\b
+ |
+ \[[-+]?\d[^\]]*\]
)
- \b
)?
/inx,
' ')
@@ -1017,6 +1018,14 @@ class Date
end
if $5
e.zone = $5
+ if e.zone[0,1] == '['
+ o, n, = e.zone[1..-2].split(':')
+ e.zone = n || o
+ if /\A\d/ =~ o
+ o = format('+%s', o)
+ end
+ e.offset = zone_to_diff(o)
+ end
end
true
end
@@ -1034,7 +1043,7 @@ class Date
e._comp = comp
- str.gsub!(/[^-+',.\/:0-9@a-z\x80-\xff]+/in, ' ')
+ str.gsub!(/[^-+',.\/:0-9@a-z\[\]\x80-\xff]+/in, ' ')
_parse_time(str, e) # || _parse_beat(str, e)
_parse_day(str, e)