Skip to content

Commit 1ce9236

Browse files
committed
Fixed serialization of timezone-naive timestamps in GanttData. Closes #29.
1 parent 814baae commit 1ce9236

File tree

1 file changed

+5
-0
lines changed
  • highcharts_gantt/options/series/data

1 file changed

+5
-0
lines changed

highcharts_gantt/options/series/data/gantt.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,15 @@ def _to_untrimmed_dict(self, in_cls = None) -> dict:
345345
}
346346

347347
if self.end is not None and hasattr(self.end, 'timestamp'):
348+
if not self.end.tzinfo:
349+
self.end = self.end.replace(tzinfo = datetime.timezone.utc)
348350
untrimmed['end'] = self.end.timestamp() * 1000
349351
else:
350352
untrimmed['end'] = self.end
351353
if self.start is not None and hasattr(self.start, 'timestamp'):
354+
if not self.start.tzinfo:
355+
self.start = self.start.replace(tzinfo = datetime.timezone.utc)
356+
352357
untrimmed['start'] = self.start.timestamp() * 1000
353358
else:
354359
untrimmed['start'] = self.start

0 commit comments

Comments
 (0)