From 55596ef8c29ae876c718946d54de787f32033db0 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 28 Aug 2008 04:26:13 +0000 Subject: Bug 399070: Remove the 'timezone' parameter - Patch by Frédéric Buclin r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buglist.cgi | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'buglist.cgi') diff --git a/buglist.cgi b/buglist.cgi index 3baeee291..6619fdd65 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -204,18 +204,17 @@ foreach my $chart (@charts) { # Utilities ################################################################################ -local our @weekday= qw( Sun Mon Tue Wed Thu Fri Sat ); sub DiffDate { my ($datestr) = @_; my $date = str2time($datestr); my $age = time() - $date; - my ($s,$m,$h,$d,$mo,$y,$wd)= localtime $date; + if( $age < 18*60*60 ) { - $date = sprintf "%02d:%02d:%02d", $h,$m,$s; + $date = format_time($datestr, '%H:%M:%S'); } elsif( $age < 6*24*60*60 ) { - $date = sprintf "%s %02d:%02d", $weekday[$wd],$h,$m; + $date = format_time($datestr, '%a %H:%M'); } else { - $date = sprintf "%04d-%02d-%02d", 1900+$y,$mo+1,$d; + $date = format_time($datestr, '%Y-%m-%d'); } return $date; } @@ -1077,16 +1076,12 @@ while (my @row = $buglist_sth->fetchrow_array()) { $bug->{'changeddate'} =~ s/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/$1-$2-$3 $4:$5:$6/; - # Put in the change date as a time, so that the template date plugin - # can format the date in any way needed by the template. ICS and Atom - # have specific, and different, date and time formatting. - $bug->{'changedtime'} = str2time($bug->{'changeddate'}, Bugzilla->params->{'timezone'}); - $bug->{'changeddate'} = DiffDate($bug->{'changeddate'}); + $bug->{'changedtime'} = $bug->{'changeddate'}; # for iCalendar and Atom + $bug->{'changeddate'} = DiffDate($bug->{'changeddate'}); } if ($bug->{'opendate'}) { - # Put in the open date as a time for the template date plugin. - $bug->{'opentime'} = str2time($bug->{'opendate'}, Bugzilla->params->{'timezone'}); + $bug->{'opentime'} = $bug->{'opendate'}; # for iCalendar $bug->{'opendate'} = DiffDate($bug->{'opendate'}); } -- cgit v1.2.3-24-g4f1b