mblackstock / node-red-contrib-influxdb

Node-RED nodes to save and query data from an influxdb time series database
Other
64 stars 44 forks source link

wrong time using timezone in the query #106

Closed eicheg closed 3 years ago

eicheg commented 3 years ago

Hello, I like to use these nodes. Thank you for that. By using the node "influxdb in" I get the following issue. For example I use a "select" query like this: select * from occured where time >= now() - 1d tz('Europe/Berlin') The answer contains the time without localization, e.g. "time": "2021-08-23T04:57:29.000Z" But if I insert an alias like this: select time as t, * from occured where time >= now() - 1d tz('Europe/Berlin'), then I get the wanted time with the expected localization, e.g. "t": "2021-08-23T06:57:29+02:00". This issue doesn't occur in the raw output format or at the influx command line. Inserting an alias is just a workaround, but no solution. Kind regards

mblackstock commented 3 years ago

Yes, this has been raised before. I don't have a good solution other than to take care of the timezone on the client side. The underlying library does not return timestamps that incorporate timezone information by default. See #98 and refs there, as well as influxdata/influxdb#8460

eicheg commented 3 years ago

Thanks for your answer