Support timedelta in CSV import/export

issue9220
review297531002
This commit is contained in:
Cédric Krier committed 2020-10-11 19:04:16 +02:00
1 parent 857cfd8f45
commit e0c01e886c
2 files changed
+6

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Format timedelta in CSV export
* Manage symbol widget
* Fallback to model name as title
* Manage deletable and writable state
+5
View File
@@ -390,6 +390,11 @@ class WinExport(WinCSV):
val = val.strftime(common.date_format() + ' %X')
elif isinstance(val, datetime.date):
val = val.strftime(common.date_format())
elif isinstance(val, datetime.timedelta):
val = common.timedelta.format(
val, {'s': 1, 'm': 60, 'h': 60 * 60})
elif isinstance(val, datetime.timedelta):
val = val.total_seconds()
elif isinstance(val, bool):
val = int(val)
row.append(val)