Catalog/datetime-add-iso-duration

Date & Time

Add ISO-8601 duration (calendar) API

Adds or subtracts an ISO-8601 duration (P1Y2M10DT2H30M) to a datetime using CALENDAR-accurate month/year arithmetic — clamping to month-end (Jan 31 + P1M = Feb 28/29) rather than nominal 30-day months. Answers 'What is Jan 31 + 1 month?', 'Add P1Y2M to this date correctly.'.

Price$0.04per request
MethodPOST
Route/v1/datetime/add-iso-duration
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
datetimeiso-8601durationaddcalendarmonth-enddate-mathperiod
API URLhttps://x402.hexl.dev/v1/datetime/add-iso-duration
Integration docs
Example request
{
  "date": "2026-01-31T00:00:00Z",
  "duration": "P1M"
}
Example response
{
  "start": "2026-01-31T00:00:00.000Z",
  "duration": "P1M",
  "result": "2026-02-28T00:00:00.000Z",
  "resultWeekday": "Saturday",
  "dayClampedToMonthEnd": true,
  "interpretation": "P1M added to 2026-01-31T00:00:00.000Z (calendar-accurate) = 2026-02-28T00:00:00.000Z (day clamped to month end)."
}
Input schema
{
  "type": "object",
  "required": [
    "date",
    "duration"
  ],
  "properties": {
    "date": {
      "type": "string",
      "examples": [
        "2026-01-31T00:00:00Z"
      ]
    },
    "duration": {
      "type": "string",
      "examples": [
        "P1M"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}