There are probably a few ways to do this. I would set up weekly bars aligned to say midnight Monday UTC and calculate the range directly.