This loop should probably be changed to [0..7) and used as an offset on the first day of week. Seems much more clear.