Commit 114db9a8 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 487865: Exporting bugs in XML format uses non-unique timezones (they cannot…

Bug 487865: Exporting bugs in XML format uses non-unique timezones (they cannot be imported back) - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=ghendricks a=LpSolit
parent 461d51d5
......@@ -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;
......
......@@ -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 %]>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment