]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 487865: Exporting bugs in XML format uses non-unique timezones (they cannot be...
authorlpsolit%gmail.com <>
Fri, 10 Apr 2009 22:09:32 +0000 (22:09 +0000)
committerlpsolit%gmail.com <>
Fri, 10 Apr 2009 22:09:32 +0000 (22:09 +0000)
Bugzilla/Util.pm
template/en/default/bug/show.xml.tmpl

index 398957b13a2278814873c7859da970c8e4a3e6d4..7ed20c87521622b67511afcb9828ade98ef284b4 100644 (file)
@@ -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;
index cd7f44eff99227746ba3dd9404527ffe8f655683..cb0b10a42981dfb7942917d560ba39ea70e3a558 100644 (file)
@@ -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>
     [% 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 %]>