summaryrefslogtreecommitdiff
path: root/lib/parsedate.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-24 08:21:56 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-24 08:21:56 +0000
commita1b57d0add85a248666fb55c58aa8c0c772136fc (patch)
tree3d30e530b29103ce2884dff782592ddf7292f4df /lib/parsedate.rb
parenta281c996689240dc204f0c534cfe21ee6cbb6863 (diff)
1.4.1 to be
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/parsedate.rb')
-rw-r--r--lib/parsedate.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/parsedate.rb b/lib/parsedate.rb
index 6afec0f..ff41d16 100644
--- a/lib/parsedate.rb
+++ b/lib/parsedate.rb
@@ -27,7 +27,7 @@ module ParseDate
if date.sub!(/(#{DAYPAT})[a-z]*,?/i, ' ')
wday = DAYS[$1.downcase]
end
- if date.sub!(/(\d+):(\d+)(?::(\d+))?\s*(am|pm)?\s*(?:\s+([a-z]{1,4}(?:\s+[a-z]{1,4})?|[-+]\d{4}))?/i, ' ')
+ if date.sub!(/(\d+):(\d+)(?::(\d+))?(?:\s*(am|pm))?(?:\s+([a-z]{1,4}(?:\s+[a-z]{1,4})?|[-+]\d{4}))?/i, ' ')
hour = $1.to_i
min = $2.to_i
if $3
@@ -62,6 +62,16 @@ module ParseDate
mday = $1.to_i
mon = MONTHS[$2.downcase]
year = $3.to_i
+ elsif date.sub!(/(\d+)-(#{MONTHPAT})-(\d+)/i, ' ')
+ mday = $1.to_i
+ mon = MONTHS[$2.downcase]
+ year = $3.to_i
+ end
+ p date
+ if date.sub!(/\d{4}/i, ' ')
+ year = $&.to_i
+ elsif date.sub!(/\d\d/i, ' ')
+ year = $&.to_i
end
if guess
if year < 100
@@ -71,10 +81,6 @@ module ParseDate
year += 2000
end
end
- elsif date.sub!(/(\d+)-(#{MONTHPAT})-(\d+)/i, ' ')
- mday = $1.to_i
- mon = MONTHS[$2.downcase]
- year = $3.to_i
end
return year, mon, mday, hour, min, sec, zone, wday
end