Changeset 3143

Show
Ignore:
Timestamp:
11.06.2002 14:21:46 (17 years ago)
Author:
jrm21
Message:

Minor tweak for badly formatted dates. We now use a window, so anything less than 20 is assumed to be 2000 - 2020, and anything over 20 is assumed to be 1920. (I got spam dated "22 May 01" or some such). Previously we were just adding 1900, which meant 1901 in this case.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/EMAILPlug.pm

    r3136 r3143  
    274274    $value = $raw{"Date"}; 
    275275    my ($day, $month, $year) = $value =~ /(\d?\d)\s([A-Z][a-z][a-z])\s(\d\d\d?\d?)/; 
    276     if ($year < 100) { $year += 1900; } 
     276    # make some assumptions about the year formatting... 
     277    # some (old) software thinks 2001 is 101, some think 2001 is 01 
     278    if ($year < 20) { $year += 2000; } # assume not really 1920... 
     279    elsif ($year < 150) { $year += 1900; } # assume not really 2150... 
    277280    $raw{"Date"} = &sorttools::format_date($day, $month, $year); 
    278281