Loop through months (1-12) I currently have this monstrosity:

next_period = (((current_month + tax_period_months)-1) % 12) + 1 


I want to get the month that is tax_period_months after the current month.

E.g. if tax_period_months=3, and current_month=09 then next_period=12

This works, but has that horrible -1 +1 to stop month 12 becoming 0

Any alternatives?
If that really is all you need to calculate, then it's not too bad.

However, I suspect that you have other date calculations happening in your application.  In that case, why not take advantage of Ruby's Date class?  The &gt;&gt; operator adds months.

require 'date'
next_period = (Date.today &gt;&gt; tax_period_months).month