New answers tagged

1

This code should be counting from -2 to +2. You thought you were setting the month, but you're adding an offset instead. Consider the first month. You end up doing 9 minus 3 to get 6, so then you're adding 6 months to 9, which rolls over to March of next year (9 + 6 = 15, so we modulus 12, to get to month 3, or March). We fix this by counting from -2 to +2, ...


Top 50 recent answers are included