Calendar-month arithmetic

What happens when the target month has no matching day?

DYFRO uses clamping: the result becomes the last valid day of the target month.

Clamping

January 31 + one month becomes the last day of February. February 29 + one calendar year becomes February 28 in a non-leap year.

Overflow differs

Some programming environments instead overflow extra days into the next month, producing a different date.

Repeated periods

A sequence of monthly operations can differ from one larger operation if an application resets from each clamped result. Document the intended rule for recurring billing or reporting.

Why it matters

Billing cycles, subscriptions, leases, and reporting periods need a documented month-end convention.

Month-end stress test

Try a start date near the 29th, 30th or 31st.

Compare a fixed 30-day interval with one calendar month from the same start date. The result exposes clamping and shows why a month is not a fixed number of days.

Live comparison

30 days vs 1 month

Change the start date and watch the difference move.

Runs in your browser
Keep checking

Related date tools