mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
7313b14021
commit
b9ff18fa6e
2 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat May 19 10:29:18 2007 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* lib/date/format.rb (Date._parse): detects some OFX dates
|
||||||
|
(Of course not fully).
|
||||||
|
|
||||||
Fri May 18 23:07:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Fri May 18 23:07:33 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* array.c (rb_ary_first): call rb_ary_subseq() instead of pushing
|
* array.c (rb_ary_first): call rb_ary_subseq() instead of pushing
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# format.rb: Written by Tadayoshi Funaba 1999-2007
|
# 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'
|
require 'rational'
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ class Date
|
||||||
end
|
end
|
||||||
|
|
||||||
def self._parse_dot(str, e) # :nodoc:
|
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)
|
s3e(e, $1, $2, $3)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -910,11 +910,12 @@ class Date
|
||||||
(?:
|
(?:
|
||||||
\s*
|
\s*
|
||||||
(
|
(
|
||||||
Z
|
Z\b
|
||||||
|
|
|
|
||||||
[-+]\d{1,4}
|
[-+]\d{1,4}\b
|
||||||
|
|
|
||||||
|
\[[-+]?\d[^\]]*\]
|
||||||
)
|
)
|
||||||
\b
|
|
||||||
)?
|
)?
|
||||||
/inx,
|
/inx,
|
||||||
' ')
|
' ')
|
||||||
|
@ -1017,6 +1018,14 @@ class Date
|
||||||
end
|
end
|
||||||
if $5
|
if $5
|
||||||
e.zone = $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
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -1034,7 +1043,7 @@ class Date
|
||||||
|
|
||||||
e._comp = comp
|
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_time(str, e) # || _parse_beat(str, e)
|
||||||
_parse_day(str, e)
|
_parse_day(str, e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue