MMonthAnchor
Product

Product features · Clamped calendar month shifts

01

Check January 31 in leap and non-leap years plus a negative shift, rejecting fractional offsets and years outside the supported range.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Clamped calendar month shifts

● ● ●MonthAnchor●
A concrete starting point · Clamped calendar month shifts ×
from calendar import monthrange
from datetime import date

def add_months(day, delta):
    if type(day) is not date or type(delta) is not int:
        raise ValueError("month.input")
    year, month0 = divmod(day.year * 12 + day.month - 1 + delta, 12)
    if not 1 <= year <= 9999:
        raise ValueError("month.year")
    last = monthrange(year, month0 + 1)[1]
    return date(year, month0 + 1, min(day.day, last))
✳Clamped calendar month shifts
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗