diff options
author | lpsolit%gmail.com <> | 2009-04-11 00:07:41 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2009-04-11 00:07:41 +0200 |
commit | 114db9a8388cfda7f293a2ac3354ad39818f3488 (patch) | |
tree | b6d04378895d0b58f872f03d37ce2a16e69d7b63 | |
parent | 461d51d5078bd9971593296dbc35d3e37e48df9b (diff) | |
download | bugzilla-114db9a8388cfda7f293a2ac3354ad39818f3488.tar.gz bugzilla-114db9a8388cfda7f293a2ac3354ad39818f3488.tar.xz |
Bug 487865: Exporting bugs in XML format uses non-unique timezones (they cannot be imported back) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=ghendricks a=LpSolit
-rw-r--r-- | Bugzilla/Util.pm | 7 | ||||
-rw-r--r-- | template/en/default/bug/show.xml.tmpl | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 398957b13..7ed20c875 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 cd7f44eff..cb0b10a42 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")) %] <long_desc isprivate="[% c.isprivate FILTER xml %]"> <who name="[% c.author.name FILTER xml %]">[% c.author.email FILTER email FILTER xml %]</who> - <bug_when>[% c.time FILTER time FILTER xml %]</bug_when> + <bug_when>[% c.time FILTER time("%Y-%m-%d %T %z") FILTER xml %]</bug_when> [% IF user.in_group(Param('timetrackinggroup')) && (c.work_time - 0 != 0) %] <work_time>[% PROCESS formattimeunit time_unit = c.work_time FILTER xml %]</work_time> [% END %] @@ -97,7 +97,7 @@ isprivate="[% a.isprivate FILTER xml %]" > <attachid>[% a.id %]</attachid> - <date>[% a.attached FILTER time FILTER xml %]</date> + <date>[% a.attached FILTER time("%Y-%m-%d %R %z") FILTER xml %]</date> <desc>[% a.description FILTER xml %]</desc> <filename>[% a.filename FILTER xml %]</filename> <type>[% a.contenttype FILTER xml %]</type> @@ -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 %]</[% field %]> |