From a9662810df18371af7492dd8298cc0cccc13c7c7 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 18 Feb 1998 01:56:47 +0000 Subject: 1.1b8pre1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@76 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/date.rb | 6 +++--- lib/parsearg.rb | 2 +- lib/parsedate.rb | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/date.rb b/lib/date.rb index 2d5090b62b..030b8a3afb 100644 --- a/lib/date.rb +++ b/lib/date.rb @@ -1,8 +1,8 @@ # # Date.rb - # $Release Version: $ -# $Revision: 1.1.1.1.4.2 $ -# $Date: 1998/02/02 04:49:13 $ +# $Revision: 1.1.1.1.4.3 $ +# $Date: 1998/02/03 10:02:57 $ # by Yasuo OHBA(SHL Japan Inc. Technology Dept.) # # -- @@ -183,7 +183,7 @@ end def Date.at(d) if d.kind_of? Time - return Date.new(1900+d.year, d.mon+1, d.mday) + return Date.new(d.year, d.mon, d.mday) end if d.kind_of? Date return Date.at(d.period) diff --git a/lib/parsearg.rb b/lib/parsearg.rb index 6811dd3b97..fa4dbdefcc 100644 --- a/lib/parsearg.rb +++ b/lib/parsearg.rb @@ -13,7 +13,7 @@ $RCS_ID=%q$Header$ -load("getopts.rb") +require "getopts" def printUsageAndExit() if $USAGE diff --git a/lib/parsedate.rb b/lib/parsedate.rb index 861e036264..4ae8fc1550 100644 --- a/lib/parsedate.rb +++ b/lib/parsedate.rb @@ -10,8 +10,10 @@ module ParseDate DAYPAT = DAYS.keys.join('|') def parsedate(date) - # ISO 8601? - if date =~ /^(\d\d\d\d)-?(?:(\d\d)-?(\d\d)?)? *(?:(\d\d):(\d\d)(?::(\d\d))?)?$/ + # part of ISO 8601 + # yyyy-mm-dd | yyyy-mm | yyyy + # date hh:mm:ss | date Thh:mm:ss + if date =~ /^(\d\d\d\d)-?(?:(\d\d)-?(\d\d)?)? *T?(?:(\d\d):?(\d\d):?(\d\d)?)?$/ return $1.to_i, if $2 then $2.to_i else 1 end, if $3 then $3.to_i else 1 end, -- cgit v1.2.3