From: lpsolit%gmail.com <> Date: Fri, 10 Apr 2009 22:09:32 +0000 (+0000) Subject: Bug 487865: Exporting bugs in XML format uses non-unique timezones (they cannot be... X-Git-Tag: bugzilla-3.4rc1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=525cf582b414597b1ba6a95587179a2b9c96f2d7;p=thirdparty%2Fbugzilla.git Bug 487865: Exporting bugs in XML format uses non-unique timezones (they cannot be imported back) - Patch by Frédéric Buclin r=ghendricks a=LpSolit --- diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 398957b13a..7ed20c8752 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -426,6 +426,13 @@ sub format_time { # strptime($date) returns an empty array if $date has an invalid date format. my @time = strptime($date); + unless (scalar @time) { + # If an unknown timezone is passed (such as MSK, for Moskow), strptime() is + # unable to parse the date. We try again, but we first remove the timezone. + $date =~ s/\s+\S+$//; + @time = strptime($date); + } + if (scalar @time) { # Fix a bug in strptime() where seconds can be undefined in some cases. $time[0] ||= 0; diff --git a/template/en/default/bug/show.xml.tmpl b/template/en/default/bug/show.xml.tmpl index cd7f44eff9..cb0b10a429 100644 --- a/template/en/default/bug/show.xml.tmpl +++ b/template/en/default/bug/show.xml.tmpl @@ -79,7 +79,7 @@ [% NEXT IF c.isprivate && !user.in_group(Param("insidergroup")) %] [% c.author.email FILTER email FILTER xml %] - [% c.time FILTER time FILTER xml %] + [% c.time FILTER time("%Y-%m-%d %T %z") FILTER xml %] [% IF user.in_group(Param('timetrackinggroup')) && (c.work_time - 0 != 0) %] [% PROCESS formattimeunit time_unit = c.work_time FILTER xml %] [% END %] @@ -97,7 +97,7 @@ isprivate="[% a.isprivate FILTER xml %]" > [% a.id %] - [% a.attached FILTER time FILTER xml %] + [% a.attached FILTER time("%Y-%m-%d %R %z") FILTER xml %] [% a.description FILTER xml %] [% a.filename FILTER xml %] [% a.contenttype FILTER xml %] @@ -146,7 +146,7 @@ [% ELSIF field == 'cc' %] [% val = val FILTER email %] [% ELSIF field == 'creation_ts' OR field == 'delta_ts' %] - [% val = val FILTER time %] + [% val = val FILTER time("%Y-%m-%d %T %z") %] [% END %] <[% field %][% IF name != '' %] name="[% name FILTER xml %]"[% END -%]> [%- val FILTER xml %]