I need to write an flux string in such a way as to get data for a week, but not the |> range(start: -1w), but the calendar week, that is, in my case - 02.10.2023 00:00:00.
It would also be interesting to know how to get data from the beginning of a calendar month/quarter/year.
I tried using
|> range(start: date.truncate(t: now(), unit: 1w))
|> range(start: -1w)
but I get either the start of the current day or the start of the day that was 7 days ago.
I also tried to use date.add() in combination with date.weekDay(), but I got an error because the d: parameter expects Duration, not the number of days.
I need the calendar start of the week.
Finally, combination of methods
date.truncateandtimeShifthelped me to solve my problem.