Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Aloisius
· 3y ago · 0 comments
I must be missing something. That is how modulo works. Well as long as January is month 0.
Comments
[–]
SoftAnnaLee
3y ago
It seems that the issue is that `January === 1`; so when you get to December (i.e. `12`) it rolls over to 0 rather than remaining as 12.
[–]
thaumasiotes
3y ago
You want (current_month % 12) + 1.