{"id":"interval-duration-check","version":"1.0.0","description":"Check a claimed duration between two RFC 3339 instants as exact elapsed time or as a calendar duration.","supported_operations":["check elapsed time between two timestamps","verify claimed duration between start and end","validate years months days between two dates","is PT36H the right elapsed time","check calendar difference of two instants","audit nanoseconds between rfc 3339 times"],"unsupported_operations":["IANA time zones or daylight-saving rules (fixed offsets only)","leap-second counting (UTC seconds are 86400 per day)","negative intervals (end before start)","business days or working hours between dates"],"semantics":["Reference: ISO 8601-1:2019 durations and time intervals (start no later than end) and RFC 3339 section 5.6 date-time; reference_version is returned with every result.","start and end: RFC 3339 date-time with offset (same rules as duration-application-check); end before start is invalid_input.","mode elapsed: exact time only. claim.elapsed_nanoseconds is the integer end - start in nanoseconds; claim.duration must use only H, M, S (any nominal Y, M, W or D component gives reason nominal_component) and its exact total must equal the elapsed time. offset_policy and rollover must be omitted.","mode calendar_balanced: claim.duration must equal the balanced decomposition: the largest whole month count m with start + m months <= end (rollover on the local date), years = floor(m / 12), months = m mod 12, weeks 0, then whole days, then hours < 24, minutes < 60, seconds < 60 with up to 9 fractional digits.","mode calendar_consistent: applying claim.duration to start (months, then days, then exact time, as in duration-application-check) must give exactly the end instant; reason end_mismatch otherwise.","Calendar modes require offset_policy (keep_start_offset: local dates in the start offset; utc) and rollover (clamp or overflow); the end is viewed in the same frame.","Comparison order: elapsed_nanoseconds then duration (elapsed); years, months, weeks, days, hours, minutes, seconds (balanced). actual values are canonical: integer nanoseconds, decimal components, PT..H..M..S text, or RFC 3339 text."],"limits":{"max_duration_chars":100,"max_timestamp_chars":64,"max_claim_chars":100},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["start","end","mode","claim"],"properties":{"start":{"type":"string","minLength":20,"maxLength":64},"end":{"type":"string","minLength":20,"maxLength":64},"mode":{"type":"string","enum":["elapsed","calendar_balanced","calendar_consistent"]},"offset_policy":{"type":"string","enum":["keep_start_offset","utc"]},"rollover":{"type":"string","enum":["clamp","overflow"]},"claim":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"elapsed_nanoseconds":{"type":"string","minLength":1,"maxLength":100,"pattern":"^(0|[1-9][0-9]*)$"},"duration":{"type":"string","maxLength":100}}}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","mode","reference_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"elapsed_mismatch","nominal_component","duration_mismatch","component_mismatch","end_mismatch"]},"first_discrepancy":{"type":["object","null"],"additionalProperties":false,"required":["field","claimed","actual"],"properties":{"field":{"type":"string","enum":["elapsed_nanoseconds","duration","end","years","months","weeks","days","hours","minutes","seconds"]},"claimed":{"type":"string"},"actual":{"type":["string","null"]}}},"mode":{"type":"string","enum":["elapsed","calendar_balanced","calendar_consistent"]},"reference_version":{"type":"string"}}},"examples":[{"input":{"start":"2024-03-09T12:00:00Z","end":"2024-03-11T00:00:00Z","mode":"elapsed","claim":{"duration":"PT36H","elapsed_nanoseconds":"129600000000000"}},"output":{"valid":true,"reason":null,"first_discrepancy":null,"mode":"elapsed","reference_version":"ISO 8601-1:2019 durations (designator format) + RFC 3339 (2002) timestamps; r66-duration-claim-verifiers@1.0.0"}},{"input":{"start":"2024-01-31T00:00:00Z","end":"2024-03-01T00:00:00Z","mode":"calendar_balanced","offset_policy":"utc","rollover":"clamp","claim":{"duration":"P1M"}},"output":{"valid":false,"reason":"component_mismatch","first_discrepancy":{"field":"days","claimed":"0","actual":"1"},"mode":"calendar_balanced","reference_version":"ISO 8601-1:2019 durations (designator format) + RFC 3339 (2002) timestamps; r66-duration-claim-verifiers@1.0.0"}}],"execute_url":"/v1/tools/interval-duration-check/versions/1.0.0/execute"}