Spec the billing date for month-end signups
Your task
Your subscription service is written in Rust, and each customer is billed monthly on the day they signed up. An agent will write the function that gives the billing date for any cycle. Last year's version added 30 days per cycle, and customers who signed up on the 31st complained.
Write the spec you would hand the agent.
What you know:
- the
chronocrate is already a dependency - signup dates are stored as
NaiveDatein the customer's own calendar, not as timestamps - finance wants a customer who signed up on January 31 billed on the last day of shorter months
Then, in a few sentences: what does "add one month to the date" get wrong?