Automation URL Contract
Who this is for: AI agents, automation scripts, and advanced users constructing calculator URLs directly.
Estimated read time: 4 minutes.

Example view: app loaded from URL query state with chained operations already applied.
URL-as-API model
Calculator state is encoded in query parameters:
s: start date input (nowor explicit date/datetime)o{index}: operation token in<direction>:<amount>:<unit>
Example:
?s=now&o0=subtract:90:days&o1=add:2:hours
Parameter contract
s (start date)
- Required when any
o{index}operation is present - Typical values:
now2026-02-212026-02-21T08:30:00Z
o{index} (operations)
- Key format:
o0,o1,o2, … - Value format:
direction:amount:unit amountmust be integer>= 0
Valid directions:
addsubtractsnap
Valid units:
- arithmetic:
years,months,days,hours,minutes,seconds - snap:
startOfDay,endOfDay,startOfMonth,endOfMonth
Canonical examples
90 days ago from now
?s=now&o0=subtract:90:days
Fixed date with chained operations
?s=2026-02-21&o0=add:1:months&o1=subtract:2:days
Snap to start of month
?s=2026-02-21T08:30:00Z&o0=snap:0:startOfMonth
Validation and fallback semantics
- Missing
swith operations: invalid URL state - Invalid direction, amount, or unit: malformed URL state
- Invalid state triggers safe fallback defaults with hydration warning
Agent best practices
- Prefer explicit dates when deterministic behavior matters
- Use
nowonly for real-time intent - Keep chains short and audit-friendly
- Preserve generated links in PRs/runbooks for reproducibility
Suggested agent algorithm
- Choose deterministic start date or
now. - Build
s. - Map each operation to one
o{index}token. - Validate against allowed directions/units and amount bounds.
- Emit full URL and store as reproducible artifact.