Timeshift() does not shift correctly (or does it?)

Hi All,

I have the following data:

image

Now I want to shift that one month backwards, meaning that it starts January 1st, and then February 1st, Match 1st and so on. But if I now use:

|> timeShift(duration: -1mo)

I get the following result:

image

which looks like timeshift just substracts a fixed amount of days instead of a correct calendar month.
Is this the expected behaviour? If yes, what can I do the get the desired result?

Best regards,
Oliver

Hello @Sparx82,
I don’t believe that is expected behavior. I think it might be a bug (depending on your version). What version of InfluxDB and Flux are you using? Do you mind exporting your data to annotatedCSV and sharing with me?
Thank you.

I’m using InfluxDB v2.4.0.

I investigated a little bit further and it looks like it is a problem with the timezone.

Without any timezone settings and without timeshift:

image

Without any timezone settings and with timeshift:

image

Now I add my timezone setting:

option location = timezone.location(name: "Europe/Zurich")

image

Please note that I have an aggreagteWindow in there, which supports the timezone as far as I know. But still strange.

  |> truncateTimeColumn(unit: 1m)
  |> aggregateWindow(every: 1mo, fn: first, createEmpty: true)

You can download the CSV data here:

It came from the following command:

currentvalues = from(bucket: "smarthome")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "ElectricalEnergy")
  |> filter(fn: (r) => r["Scope"] == "House")
  |> filter(fn: (r) => r["Source"] == "SaiaBurgess")
  |> filter(fn: (r) => r["UpdateInterval"] == "Day")
  |> filter(fn: (r) => r["_field"] == "value")
  |> truncateTimeColumn(unit: 1m)
  |> aggregateWindow(every: 1mo, fn: first, createEmpty: true)
  |> yield()

Hello @Sparx82,
It could be related to: