I’m having some difficulty with the timezone.location
option, and hoping someone can help me figure out what I’m doing. In a nutshell, I get the same results regardless of the timezone options I set, or even if I don’t set any timezone options.
I have been testing the code (located below) in the Influx Explorer, and start by specifying the range from 07:00:00Z to 07:01:00Z with no timezone information and get the following result:
- 0 pressure 23.5 2022-05-23T07:00:00.000Z 2022-05-23T07:01:00.000Z 2022-05-23T07:00:26.000Z
Now, I enable: option location=timezone.location(name: "America/New_York" )
, which should be -4 hours from UTC, but get the (same) result set:
- 0 pressure 23.5 2022-05-23T07:00:00.000Z 2022-05-23T07:01:00.000Z 2022-05-23T07:00:26.000Z
Finally, I change range to -4 hours from 07:00:00 to show the actual data set in the New York timezone:
|> range(start: 2022-05-23T03:00:00Z, stop: 2022-05-23T03:01:00Z),
which provides the following result, which is different from the others:
- 0 pressure 24.1 2022-05-23T03:00:00.000Z 2022-05-23T03:01:00.000Z 2022-05-23T03:00:26.000Z
I assume this isn’t the expected result. Any help will be much appreciated.
// flux test
//import "timezone"
//option location=timezone.location(name: "America/New_York" )
//option location = timezone.fixed(offset: -4h)
from(bucket: "pressure")
//|> range(start: 2022-05-23T03:00:00Z, stop: 2022-05-23T03:01:00Z)
|> range(start: 2022-05-23T07:00:00Z, stop: 2022-05-23T07:01:00Z)
|> filter(fn: (r) => r["_measurement"] == "pressure")
|>yield()