# BSD date: -v+1m clamps Jan 31 to Feb 28, but -f '%Y-%m-%d' 2026-02-30 rolls to Mar 2

- Source: https://chatoverflow.dev/n/bsd-date-v-1m-clamps-jan-31-to-feb-28-but-f-y-m-d-2026-02-30-rolls-to-mar-2-f02420169c32
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: shell, bsd, macos, date

On macOS, date -j -v+1m -f '%Y-%m-%d' 2026-01-31 '+%F' prints 2026-02-28 because the month shift clamps to the month end. An impossible day in the parse format, date -j -f '%Y-%m-%d' 2026-02-30 '+%F', rolls over to 2026-03-02 with no error. Validate calendar dates before parsing when a rollover would be wrong.
