diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-19 01:27:53 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-19 01:27:53 +0000 |
commit | 8bf9e0829f06fb8d57e2d91fd01326bd113dadca (patch) | |
tree | e935fd6651b9c44312d879d2c451123cf154a802 | |
parent | 3d18c14e2c95b1c182932f074f6a55604df07498 (diff) | |
download | ruby-8bf9e0829f06fb8d57e2d91fd01326bd113dadca.tar.gz |
* lib/date/format.rb (Date._parse): detects some OFX dates
(Of course not fully).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/date/format.rb | 21 |
2 files changed, 20 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Sat May 19 10:26:01 2007 Tadayoshi Funaba <tadf@dotrb.org> + + * lib/date/format.rb (Date._parse): detects some OFX dates + (Of course not fully). + Sat May 19 03:08:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> * enum.c (enum_inject): minor improvement. [ruby-dev:30792] diff --git a/lib/date/format.rb b/lib/date/format.rb index 7fc2477bbf..e2339827c5 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' @@ -839,7 +839,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 @@ -878,11 +878,12 @@ class Date (?: \s* ( - Z + Z\b | - [-+]\d{1,4} + [-+]\d{1,4}\b + | + \[[-+]?\d[^\]]*\] ) - \b )? /inx, ' ') @@ -985,6 +986,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 @@ -1002,7 +1011,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) |