summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-02-18 01:56:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-02-18 01:56:47 +0000
commita9662810df18371af7492dd8298cc0cccc13c7c7 (patch)
tree5a1131ad0ca461f67177e1c7282eacc92356f864 /lib
parent14aa2e8dda852b6b9277a8a7e16a78654edf1767 (diff)
1.1b8pre1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@76 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/date.rb6
-rw-r--r--lib/parsearg.rb2
-rw-r--r--lib/parsedate.rb6
3 files changed, 8 insertions, 6 deletions
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,