Commit c37ecdf9 authored by Tijmen de Mes's avatar Tijmen de Mes

Parse ISOTimestamps for history in a python < 3.7 compatible way

parent ba8d3878
...@@ -9,7 +9,8 @@ from application.notification import IObserver, NotificationCenter, Notification ...@@ -9,7 +9,8 @@ from application.notification import IObserver, NotificationCenter, Notification
from application.python import Null from application.python import Null
from application.python.types import Singleton from application.python.types import Singleton
from datetime import date, datetime, timezone from datetime import date, timezone
from dateutil.parser import isoparse
from dateutil.tz import tzlocal from dateutil.tz import tzlocal
from zope.interface import implementer from zope.interface import implementer
...@@ -293,7 +294,7 @@ class MessageHistory(object, metaclass=Singleton): ...@@ -293,7 +294,7 @@ class MessageHistory(object, metaclass=Singleton):
timestamp_native = message.timestamp timestamp_native = message.timestamp
timestamp_utc = timestamp_native.replace(tzinfo=timezone.utc) timestamp_utc = timestamp_native.replace(tzinfo=timezone.utc)
message.timestamp = timestamp_utc - message.timestamp.utcoffset() message.timestamp = timestamp_utc - message.timestamp.utcoffset()
timestamp = datetime.fromisoformat(str(message.timestamp)) timestamp = isoparse(str(message.timestamp))
optional_fields = {} optional_fields = {}
if state is not None: if state is not None:
......
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