Windowing by week

Hi,
I try to window my data by calendar week that is
Jan. 3rd - Jan. 9th
Jan 10th - Jan. 16th …
My approach is to determine the first Sunday in the year and from that day on as range start to window every 7d.

import "timezone" 
import "experimental" 
import "date" 
option location = timezone.location(name: "Europe/Berlin") 

nextWeekday = (refDate, weekDay=date.Sunday) => {
  refWeekDay = date.weekDay(t: refDate)
  addDays = if (refWeekDay  < weekDay) then weekDay - refWeekDay  else  weekDay - refWeekDay + 7    
  return time(v: int(v: date.truncate(t: refDate, unit: 1d)) + (int(v: 24h) * addDays))
}
from(bucket:"HomeAssistant") 
|> range(start: nextWeekday(refDate: date.truncate(t:now(),unit:1y)), stop: now()) 
|> filter(fn: (r) => r.domain == "sensor" and r.entity_id == "se_production" and  r._field == "value")   
|> window(period: 7d,createEmpty: true)  
|> integral(unit: 1h) 

As a result I got
image
where

  1. the range start does not match the local time (would expect 2022-01-02T23:00:00.000Z)
  2. the first period is definitely not 7d

It seem that influx always adds a UTC datapoint as start point…
Do you see any solution/workaround…?
Thanks for help, Best