What is end-of-month clamping in date arithmetic and how does it work?
End-of-month clamping is the rule applied when adding months would produce an invalid date. The rule: when the resulting month has fewer days than the source day-of-month, clamp to the last valid day of the target month. Examples: January 31 + 1 month → February 28 (February has 28 days, clamped from 31). January 31 + 1 month in a leap year → February 29. March 31 + 1 month → April 30 (April has 30 days, clamped from 31). May 31 + 3 months → August 31 (August has 31 days, no clamping needed). This behavior is used by banks for monthly loan payments, subscription services for monthly billing, and legal contracts with monthly notice periods.