Skip to content

die-linke-app-frontend#89 Use Utc timestamp

It seems like that django executes value.astimezone(), which sometimes creates an offset containing milliseconds, which javascript can not consume the right way, see comments: https://stackoverflow.com/questions/68814876/parsing-iso-8601-date-containing-tz-offset-with-seconds To mitigate that we use .astimezone(timezone.utc)

note:

In [25]: event = Event.objects.get(pk=98)

In [27]: event.start_date.isoformat()
Out[27]: '0202-05-25T20:06:32+00:00'

# This one is usally returned by the endpoint
In [28]: event.start_date.astimezone().isoformat()
Out[28]: '0202-05-25T21:00:00+00:53:28'

In [31]: event.start_date.astimezone(timezone.utc).isoformat()
Out[31]: '0202-05-25T20:06:32+00:00'

Merge request reports

Loading