Make simplify_date always return HTML, and remove the eucconv call that's not useful for dates

This commit is contained in:
Jamie Cameron
2025-02-16 16:11:15 -08:00
parent 2e409c8647
commit 5760fb1c26
3 changed files with 7 additions and 7 deletions
+5 -4
View File
@@ -1471,7 +1471,8 @@ return $data;
}
# simplify_date(datestring, [format])
# Given a date from an email header, convert to the user's preferred format
# Given a date from an email header, convert to the user's preferred format and
# return it as an HTML string
sub simplify_date
{
local ($date, $fmt) = @_;
@@ -1494,12 +1495,12 @@ if ($u) {
}
}
elsif ($date =~ /^(\S+),\s+0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
return "$2/$3/$4 $5:$6";
return &html_escape("$2/$3/$4 $5:$6");
}
elsif ($date =~ /^0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
return "$1/$2/$3 $4:$5";
return &html_escape("$1/$2/$3 $4:$5");
}
return $date;
return &html_escape($date);
}
# simplify_from(from)
+1 -1
View File
@@ -1221,7 +1221,7 @@ foreach my $mail (@mail) {
}
# Date and size columns
push(@cols, &eucconv(&simplify_date(&html_escape($mail->{'header'}->{'date'}))));
push(@cols, &simplify_date($mail->{'header'}->{'date'}));
push(@cols, &nice_size($mail->{'size'}, 1024));
$rowtds[$#cols] .= " data-sort=".&parse_mail_date($mail->{'header'}->{'date'});
+1 -2
View File
@@ -140,8 +140,7 @@ else {
&address_link($mail->{'header'}->{'cc'}));
}
print &ui_table_row($text{'mail_date'},
&eucconv(
&simplify_date(&html_escape($mail->{'header'}->{'date'}))));
&simplify_date($mail->{'header'}->{'date'}));
print &ui_table_row($text{'mail_subject'},
&convert_header_for_display($mail->{'header'}->{'subject'}));
}