time_date_calculator
Add or subtract years, months, weeks, or days from a base date, or shift by business days that skip weekends. Returns the resulting date and total days shifted.
Instructions
Date Calculator (Add/Subtract Duration and Business Days). Add or subtract a years/months/weeks/days duration from an explicit base date, or add a signed number of business days that skips weekends, using proleptic-Gregorian UTC arithmetic. Years and months apply first with the day-of-month clamped to the last valid day (Jan 31 + 1 month is Feb 28/29, never Mar 3), then the week/day shift. Use this when you have a known start date and want the resulting date; use time_date_difference to measure the span between two dates, or time_time_duration for HH:MM:SS clock arithmetic. The caller supplies every date, so results are deterministic (no current-time dependency). Runs locally: read-only, non-destructive, contacts no external service, and is rate-limited (60 requests/minute for anonymous callers). Returns the base and result dates (year/month/day, ISO date, weekday) plus the total days shifted and, for business-day mode, the weekends skipped.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | Which calculation to run: "add" or "subtract" a calendar duration, or "addBusinessDays" to shift by weekday-only days. | |
| year | Yes | Base date year (proleptic Gregorian). | |
| month | Yes | Base date month, 1 (January) to 12 (December). | |
| day | Yes | Base date day of month; must be a real calendar day for the given year/month. | |
| years | No | Years to add (add/subtract only; ignored for addBusinessDays). | |
| months | No | Months to add (add/subtract only; ignored for addBusinessDays). | |
| weeks | No | Weeks to add (add/subtract only; ignored for addBusinessDays). | |
| days | No | Days to shift. For add/subtract, a calendar-day component in -1000..1000 (default 0); for addBusinessDays, a signed weekday-only count in -100000..100000 (negative walks backward). For add/subtract, at least one of years/months/weeks/days must be non-zero. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | No | Echo of the requested operation (add, subtract, or addBusinessDays). | |
| data | No | Result payload. Always includes base and result; add/subtract add totalDaysAdded and breakdown, addBusinessDays adds daysAdded, weekendsSkipped, and totalCalendarDaysShifted. |