Format date column consistently
authorJamie Cameron <jcameron@webmin.com>
Mon, 16 Feb 2009 23:03:49 +0000 (23:03 +0000)
committerJamie Cameron <jcameron@webmin.com>
Mon, 16 Feb 2009 23:03:49 +0000 (23:03 +0000)
mailboxes/boxes-lib.pl
mailboxes/mailboxes-lib.pl

index e36e87a..9d20734 100644 (file)
@@ -2458,7 +2458,7 @@ my $rv = eval {
                                      $7 < 50 ? $7+100 : $7 < 1000 ? $7 : $7-1900);
                return $tm;
                }
-       elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)/) {
+       elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d{1,2})\s+(\d+):(\d+):(\d+)/) {
                # Format like Tue Dec  7 12:58:52
                local @now = localtime(time());
                local $tm = timelocal($6, $5, $4, $3, &month_to_number($2),
@@ -2481,6 +2481,7 @@ my $rv = eval {
                # Format like 2004-12-07 12:53
                local $tm = timelocal(0, $4, $4, $3, $2-1,
                                      $1 < 50 ? $1+100 : $1 < 1000 ? $1 : $1-1900);
+               return $tm;
                }
        elsif ($str =~ /^(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\S+)/) {
                # Format like 30 Jun 2005 21:01:01 -0000
@@ -2507,6 +2508,7 @@ my $rv = eval {
 open(STDERR, ">&OLDSTDERR");
 close(OLDSTDERR);
 if ($@) {
+       print STDERR "parsing of $str failed : $@\n";
        return undef;
        }
 return $rv;
index e1fc0e9..fdb16c6 100644 (file)
@@ -1218,7 +1218,7 @@ foreach my $mail (@mail) {
                }
 
        # Date and size columns
-       push(@cols, &simplify_date($mail->{'header'}->{'date'}));
+       push(@cols, &simplify_date($mail->{'header'}->{'date'}, "ymd"));
        push(@cols, &nice_size($mail->{'size'}, 1024));
 
        # Subject with icons