Ref T10747. I only got this partially right:
- When the last week of the year has less than 4 days, it's counted as the first week of the next year.
- When the first week of the year has less than 4 days, it's counted as the last week of the prior year.
These rules are sort of crazy, but they work now.