Skip to content

Commit ad14702

Browse files
authored
Update odsw.py
Add 'datetime' support to pyexcel_ods3.odsw.ODSSheetWriter.write_row(array)
1 parent c4f8805 commit ad14702

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pyexcel_ods3/odsw.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def write_row(self, array):
4444
seconds = cell.seconds % 60
4545
cell = "PT%02dH%02dM%02dS" % (hours, minutes, seconds)
4646
value_type = "time"
47+
if value_type == 'datetime':
48+
cell = "%04d-%02d-%02dT%02d:%02d:%02d" % (cell.year, cell.month, cell.day,
49+
cell.hour, cell.minute, cell.second)
50+
value_type = "date"
4751
elif value_type == "float":
4852
if cell > MAX_INTEGER:
4953
raise IntegerAccuracyLossError("%s is too big" % cell)

0 commit comments

Comments
 (0)