Checking an invalid date before applying a calendar shift
The Add Months Calculator checks that the starting date exists before it shifts anything. 2026-02-29 is rejected, while the valid 2026-02-28 moves forward one month to 2026-03-28.
A date that never occurs
Gregorian years have a February 29 only when the year is a leap year. A year is a leap year if it is divisible by 4, except for century years, which must also be divisible by 400. The year 2026 is not divisible by 4, so February has 28 days and 2026-02-29 does not exist. The Add Months Calculator reports that the date does not exist instead of shifting it. Some software accepts such a date and silently converts it to March 1, and a reader of the output cannot tell that anything was changed. Rejecting the input leaves the error visible at the point where it was made.
The valid neighbor
For comparison, enter 2026-02-28 and add one month. The result is 2026-03-28. The day number stays 28 and the month increases by one. This confirms that the rejection of February 29 comes from the date being invalid and has nothing to do with the month shift itself. A single changed input, the day from 29 to 28, moves the calculation from an error to a normal answer. The valid date is also the last day of February 2026, so the result of March 28 shows an ordinary shift where the day number stays the same and does not need clamping. The pair is a useful test for any date function: one invalid date, one adjacent valid date, and a clear difference in the outcome.
Why not roll forward
Rolling an invalid date to the next valid one looks helpful and creates ambiguity. Is 2026-02-29 meant to be February 28 or March 1? Those readings differ by a day, and the right choice depends on the source of the data. If the date came from a typo, the intended date may be neither. A system that quietly picks one produces a result that looks normal and cannot be traced. Stopping with a message that says the date does not exist forces a decision by someone who knows the context, which is cheaper than correcting a wrong date after it has spread.
Month-end clamping is a different operation
The month shift itself does make adjustments, but for a different reason. Adding one month to a valid date at the end of a long month lands on a shorter month that may not have that day. The tool clamps the day to the last day of the destination month. January 31, 2026 plus one month gives 2026-02-28. January 31, 2024 plus one month gives 2024-02-29, because 2024 is a leap year. The starting dates are valid and the clamp is a stated rule of the month shift. Accepting an invalid starting date is not covered by that rule.
Shifting by years and by long spans
Because a month shift counts months, a shift of 12 months matches a one-year shift, and a shift of 24 months a two-year shift. Starting at 2026-03-31 and adding 11 months reaches February 2027, which has 28 days, so the result is 2027-02-28. Adding 12 months from the same date reaches 2027-03-31 with no clamp. Long spans do not accumulate clamping errors when the shift is applied once to the original date, because the day is limited only by the length of the destination month. Repeated one-month steps would behave differently: from January 31 the first step gives February 28, and the following steps keep day 28 instead of returning to 31. For a schedule that should keep the end of the month, shift from the original date each time.
Leap-day starting dates
A valid leap day shows both behaviors together. February 29, 2024 exists, so the calculator accepts it. Adding 12 months moves to February 2025, which has 28 days, so the day is clamped and the result is 2025-02-28. Adding 48 months reaches February 2028, a leap year, and returns 2028-02-29. The clamp therefore depends on the destination month, and it does not remember the original day. Adding 12 months and then subtracting 12 months from 2024-02-29 would not return to the same date after clamping in between, so shift directly from the original date when you can.
Where invalid dates come from
Invalid dates usually enter through manual typing, imported spreadsheets and systems that store day and month in separate fields. A form that allows 31 in every month, an import where a column was read as day-month instead of month-day, or a script that adds days to a date without checking the month can all produce a day that does not exist. February is the common offender, but April, June, September and November have only 30 days, so a 31 in those months is invalid as well. Validating the date at entry, before any calculation, prevents the invalid values from spreading to later steps. Two-digit years are another source of trouble, since a value written as 00 can mean 1900 or 2000, and 1900 was not a leap year while 2000 was. A February 29 attached to the wrong century is then rejected or accepted depending on a guess, which is one more reason to store the full four-digit year.
Keeping invalid source records visible
A rejected record is information. If a data set contains 2026-02-29, someone should find out how it got there: a typo, a conversion from another calendar, a placeholder value or a leap-year assumption in a system. Normalizing it into another date without a defined rule hides that history. A sensible practice is to list rejected values in a separate log, decide the correction case by case, and apply a documented rule only when the cause is understood. The log also shows whether the problem is a one-off or a pattern worth fixing at the source.
Calendar checks versus plausible dates
The date check applies to the Gregorian calendar used by the tool and tests only whether the day exists in its month and year. It does not test whether a date is plausible for the use, such as a birthdate in the future or an invoice date before the company existed. It also does not interpret dates written in other calendars. Enter dates in the year-month-day format shown in the example, and confirm against the source system that the same calendar was used when the date was recorded.
Reproduce the checks
Invalid starting date
Open the Add Months Calculator and enter:
- Calendar date
2026-02-29- Months
1
Expected rejection:
does not existThe starting date fails Gregorian validation.
Valid neighboring date
Open the Add Months Calculator and enter:
- Calendar date
2026-02-28- Months
1
Expected output:
Date
2026-03-28A valid date enters the month-shift calculation.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08