# CodeSOD: Next Month

DevFeed: [CodeSOD: Next Month](<https://devfeed.tech/articles/codesod-next-month-131106.md>)

Original publisher: [Read original article](<https://thedailywtf.com/articles/next-month>)

Author: Remy Porter

Published: 2026-11-12T06:30:00Z

Content type: news

Language: en

Sources: [The Daily WTF](<https://devfeed.tech/sources/the-daily-wtf.md>)

Topics: [if statement](<https://devfeed.tech/topics/if-statement.md>)

Tags: [billing](<https://devfeed.tech/tags/billing.md>), [bug](<https://devfeed.tech/tags/bug.md>), [codesod](<https://devfeed.tech/tags/codesod.md>), [net-9](<https://devfeed.tech/tags/net-9.md>)

## AI overview

A billing bug canceled all bills due in January because the code compared only the month numbers of `next_bill_date` and `end_date`, ignoring the year. When December began, January's month number was greater than or equal to the account's ending month, so the code cleared and saved those billing dates. The team could reconstruct the dates without restoring a backup, but an unknown number of customer billing periods had been canceled and required a history check.

## Source excerpt

One of Sean's colleagues left Initech on good terms. It caused no small amount of surprise that the very next day their billing system started failing. The billing system which the colleauge had worked on. No one truly suspected foul play, it was just a weird coincidence. Still, billing blowing up was a 5 alarm fire, so everyone was throwing every idea out about what could be the cause. Late in the evening, after staring at the code for many hours, Sean found this: if item.next_bill_date.month >= end_date.month item.next_bill_date = nil item.save else ... end If the month of the next billing date is greater than the last billing date for this account, wipe the billing date and update the item. It's worth noting that Sean's co-worker's last date happened to be the end of November, and billing started blowing up on the 1st of December. You'll also note this is checking just the month and not any other part of the date, like, oh, I don't know, the year? While this bug could happen to any bill, it was blowing up in December because every bill's ending month was greater than or equal to January. So this code canceled all the bills due in January. The good news was that they could reconstruct the correct next billing dates without having to restore from a backup. The bad news is that some unknown number of billing periods had been canceled for some of their customers, and someone was going to have to check the history. Sean reached out to his former co-worker to politely thank them for an early Christmas present. "At least I understand our billing code better," Sean writes. [Advertisement] Plan Your .NET 9 Migration with Confidence Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!