add_duration
Add or subtract ISO-8601 durations to any timestamp, with calendar-aware date units for DST and month-end, and exact time units for hours, minutes, and seconds.
Instructions
Add an ISO-8601 duration to a timestamp, in a timezone. Date units (Y/M/D) are calendar-aware: P1D across a DST boundary keeps the same wall-clock time the next day, and P1M on Jan 31 clamps to the end of February. Time units (H/M/S) are exact elapsed time, so PT24H really is 24 hours. Prefix the duration with '-' to subtract.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| duration | Yes | ISO-8601 duration, e.g. 'P1D', 'PT30M', 'P1Y2M3DT4H5M6S', or '-P1W'. | |
| timezone | No | IANA timezone governing the arithmetic — calendar units are applied to this zone's wall clock, and a timestamp with no 'Z' or offset is read as wall-clock time here. Defaults to UTC. | |
| isoTimestamp | Yes | ISO-8601 timestamp to shift. |