From e2391a6703139d1f1575cc4cc27c57a3a8ee709a Mon Sep 17 00:00:00 2001 From: pascalfree Date: Wed, 10 Jul 2024 02:25:01 +0200 Subject: [PATCH] fix: ods: use duration for time value as per specification --- src/tablib/formats/_ods.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tablib/formats/_ods.py b/src/tablib/formats/_ods.py index e3698771..692bb30c 100644 --- a/src/tablib/formats/_ods.py +++ b/src/tablib/formats/_ods.py @@ -92,7 +92,7 @@ def convert_date(val): return convert_date(date_value) if value_type == 'time': time_value = cell.getAttribute('timevalue') - return dt.datetime.strptime(time_value, "%H:%M:%S").time() + return dt.datetime.strptime(time_value, "PT%HH%MM%SS").time() if value_type == 'boolean': bool_value = cell.getAttribute('booleanvalue') return bool_value == 'true' @@ -163,7 +163,7 @@ def dset_sheet(cls, dataset, ws): elif isinstance(col, dt.date): cell = table.TableCell(valuetype="date", datevalue=col.strftime('%Y-%m-%d')) elif isinstance(col, dt.time): - cell = table.TableCell(valuetype="time", timevalue=col.strftime('%H:%M:%S')) + cell = table.TableCell(valuetype="time", timevalue=col.strftime('PT%HH%MM%SS')) elif col is None: cell = table.TableCell(valuetype="void") else: