Start in range does not work with aggregateWindow

In order to fetch the first data from 10:00 to 12:00 every day, I use flux as below:

from(bucket: "CS301")
  |> range(start: 2024-04-27T02:00:00Z, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "R-A5100")
  |> filter(fn: (r) => r["_field"] == "pi01")
  |> aggregateWindow(every: 1d, fn: first, createEmpty: false)
  |> yield(name: "first")

fellow returned:

Stat time have been set to 2024-04-27 11:00:00, but why data retrieved start from 2024-04-28 08:00:00?


import "timezone"
option location = timezone.location(name: "Australia/Perth")
from(bucket: "CS301")
  |> .....

or wherever you are.

aggregateWindow() works with UTC, if the location is not set.

1 Like

Thanks for you solution.

but timezone didnt work. When I change timezone, it still recurr that _time is not correct.
if there is any bug with aggregateWindow? because it does not wind according to start time.