emabee/flexi_logger

`DeferredNow::format_rfc3339` uses wrong timezone information

hasezoey opened this issue · 0 comments

Currently the timezone is defined with a Z but given a local time, but this will actually result in the wrong time

self.format("%Y-%m-%dT%H:%M:%S%.3fZ")

for example in my current timezone which is Europe/Berlin (+1h) the following happens:

name time
actual UTC time 2023-01-14T16:16:34.000Z
current function output 2023-01-14T17:16:34.000Z
using %Z 2023-01-14T17:16:34.000+01:00
using %z 2023-01-14T17:16:34.000+0100
using just %+ 2023-01-14T17:16:34.000000000+01:00
for reference JS .toISOString would output*1 2023-01-14T16:16:34.000Z

*1 given the time of 2023-01-14T17:16:34.000+01:00 (from using %Z)

possible fixes:

  • replace Z with %Z
  • actually give the format functions a UTC time