Board Thread:General Discussion/@comment-33543551-20180512093038/@comment-3361105-20180513173718

You didn't do anything wrong.

Just in case anyone's curious, I'll explain what was wrong (so I feel validated for having fixed it).

Because the number of days until the nearest Wednesday would be a negative number in the case here, the template knew to go back to the previous month. However, the template treated January(1) minus 1 as 0 (not 12; December). The template then relied on a second template to provide the number of days in the month based on the number value of that month, and I hadn't accounted for the fact that there would be some calculations where the month value would turn out to be 0 or 13. Fixed that, and that fixed the main Day Categorization template.