Commit 5bb2eeca authored by Jérome Perrin's avatar Jérome Perrin

Formulator: fix date arithmetics in DateTimeWidget.render_odt_variable

Since ODF dates are "timezone naïve", just calculate the timestamp with
the input date timezone as reference timezone.

I don't think the "XXX Works only if the timezone is the same in
OpenOffice" comment was true, so I just remove it.
parent 41c3faf6
......@@ -1629,8 +1629,7 @@ class DateTimeWidget(Widget):
# default offset is 30/12/1899
number_of_second_in_day = 86400 #24 * 60 * 60
timestamp = float(value)
# XXX Works only if the timezone is the same in OpenOffice
ooo_offset_timestamp = float(DateTime(1899, 12, 30))
ooo_offset_timestamp = float(DateTime(1899, 12, 30, 0, 0, 0, value.timezone()))
days_value = (timestamp - ooo_offset_timestamp) / number_of_second_in_day
attr_dict['{%s}formula' % TEXT_URI] = 'ooow:%f' % days_value
text_node.attrib.update(attr_dict)
......
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