diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-21 13:02:29 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-21 13:02:29 +0000 |
commit | 54057bbe33ef38bc62c092af9b4987565f5f2be0 (patch) | |
tree | 19c987533fe69437ba6d9ab66e5cf4a1e7653714 /lib/date.rb | |
parent | 2840fa6b6504de820c3ca40457306787545d27fe (diff) |
* lib/date.rb, lib/date/format.rb (Date._parse): now can take some
hints (its aim must be mainly determination of endianness of
date). [experimental]
* lib/date.rb, lib/date/format.rb (Date._parse): now completes
truncated year as default action. [experimental]
* lib/date.rb, lib/date/format.rb: added ::iso8601, ::rfc3339,
::xmlschema, ::rfc2822, ::httpdate, ::jisx0301, #xmlschema,
#httpdate. [experimental]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/date.rb')
-rw-r--r-- | lib/date.rb | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/lib/date.rb b/lib/date.rb index 0c06e41433..5ef4f871b1 100644 --- a/lib/date.rb +++ b/lib/date.rb @@ -1037,8 +1037,40 @@ class Date # Day Number day 0. # # +sg+ specifies the Day of Calendar Reform. - def self.parse(str='-4712-01-01', comp=false, sg=ITALY) - elem = _parse(str, comp) + def self.parse(str='-4712-01-01', hints={}, sg=ITALY) + elem = _parse(str, hints) + new_by_frags(elem, sg) + end + + def self.iso8601(str='-4712-01-01', sg=ITALY) # :nodoc: + elem = _iso8601(str) + new_by_frags(elem, sg) + end + + def self.rfc3339(str='-4712-01-01T00:00:00+00:00', sg=ITALY) # :nodoc: + elem = _rfc3339(str) + new_by_frags(elem, sg) + end + + def self.xmlschema(str='-4712-01-01', sg=ITALY) # :nodoc: + elem = _xmlschema(str) + new_by_frags(elem, sg) + end + + def self.rfc2822(str='Mon, 1 Jan -4712 00:00:00 +0000', sg=ITALY) # :nodoc: + elem = _rfc2822(str) + new_by_frags(elem, sg) + end + + class << self; alias_method :rfc822, :rfc2822 end + + def self.httpdate(str='Mon, 01 Jan -4712 00:00:00 GMT', sg=ITALY) # :nodoc: + elem = _httpdate(str) + new_by_frags(elem, sg) + end + + def self.jisx0301(str='-4712-01-01', sg=ITALY) # :nodoc: + elem = _jisx0301(str) new_by_frags(elem, sg) end @@ -1644,8 +1676,40 @@ class DateTime < Date # Day Number day 0. # # +sg+ specifies the Day of Calendar Reform. - def self.parse(str='-4712-01-01T00:00:00+00:00', comp=false, sg=ITALY) - elem = _parse(str, comp) + def self.parse(str='-4712-01-01T00:00:00+00:00', hints={}, sg=ITALY) + elem = _parse(str, hints) + new_by_frags(elem, sg) + end + + def self.iso8601(str='-4712-01-01T00:00:00+00:00', sg=ITALY) # :nodoc: + elem = _iso8601(str) + new_by_frags(elem, sg) + end + + def self.rfc3339(str='-4712-01-01T00:00:00+00:00', sg=ITALY) # :nodoc: + elem = _rfc3339(str) + new_by_frags(elem, sg) + end + + def self.xmlschema(str='-4712-01-01T00:00:00+00:00', sg=ITALY) # :nodoc: + elem = _xmlschema(str) + new_by_frags(elem, sg) + end + + def self.rfc2822(str='Mon, 1 Jan -4712 00:00:00 +0000', sg=ITALY) # :nodoc: + elem = _rfc2822(str) + new_by_frags(elem, sg) + end + + class << self; alias_method :rfc822, :rfc2822 end + + def self.httpdate(str='Mon, 01 Jan -4712 00:00:00 GMT', sg=ITALY) # :nodoc: + elem = _httpdate(str) + new_by_frags(elem, sg) + end + + def self.jisx0301(str='-4712-01-01T00:00:00+00:00', sg=ITALY) # :nodoc: + elem = _jisx0301(str) new_by_frags(elem, sg) end |