From a1b57d0add85a248666fb55c58aa8c0c772136fc Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 24 Aug 1999 08:21:56 +0000 Subject: 1.4.1 to be git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/parsedate.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/parsedate.rb') diff --git a/lib/parsedate.rb b/lib/parsedate.rb index 6afec0ff06..ff41d162ad 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 -- cgit v1.2.3