MonthstepCalendar months, with the rule in view

WORKED EXAMPLES

Watch the day number as the month changes.

Every example starts with the date shown. No result is a recurring rule or an elapsed-time measurement.

January 31 into a leap February

Source 2024-01-31, offset 1. February 2024 has 29 days. Under constrain, the result is 2024-02-29, with the day changed from 31 to 29. The civil day difference is +29. Under Reject missing day, the result is unavailable.

The same shift in a common year

Source 2023-01-31, offset 1, constrain. February 2023 has 28 days, so the result is 2023-02-28. The civil day difference is +28. This is one reason “one month” is not a fixed 30-day duration.

Two months at once versus two separate steps

Source 2024-01-31, offset 2, constrain. The target month is March, which has day 31, so the result is 2024-03-31. If you instead calculate one month, take February 29 as a new source, then calculate another month, the new result is 2024-03-29. The two requests carry different source dates.

Moving earlier

Source 2024-03-31, offset −1, constrain. The target is February 2024; day 31 is unavailable, so the result is 2024-02-29. A negative offset follows the same day policy as a positive one.

A year after February 29

Source 2024-02-29, offset 12, constrain. The target February is in 2025, which has only 28 days. The result is 2025-02-28. With Reject missing day it is unavailable. There is no automatic assumption about anniversaries, billing or deadlines.

Last day is not a special instruction

Source 2024-04-30, offset 1. May has day 30, so both policies produce 2024-05-30. Monthstep does not change it to May 31 simply because April 30 was the source month’s last day.

A target beyond the supported range

Source 9999-12-31, offset 1. The target year would be 10000, so the result is unavailable under either policy. Constrain applies to a missing day inside a supported month; it does not extend the product’s year range.

Try these inputs → · Read the model limits