{"id":"iso-duration-structure-check","version":"1.0.0","description":"Check a claimed reading of an ISO 8601 duration: well-formedness, components and month/day/time totals.","supported_operations":["check if an iso 8601 duration string is valid","verify parsed duration components","is P1M one month or one minute","validate rfc 3339 duration syntax","check claimed total months and days of a duration","find where an iso duration string is malformed","confirm duration hours minutes seconds breakdown"],"unsupported_operations":["negative or signed durations (ISO 8601-2 extension, -P1D)","the alternative format PYYYY-MM-DDThh:mm:ss","converting calendar months or days to seconds","time intervals with start/end solidus notation"],"semantics":["Reference: ISO 8601-1:2019 duration representations with designators (PnYnMnDTnHnMnS, PnW) and RFC 3339 Appendix A duration ABNF; reference_version is returned with every result.","profile \"iso8601-1-2019\": P, then either nW alone or date components Y, M, D in that order and optionally T with H, M, S in that order; zero components may be omitted but at least one must be present; T only when a time component follows; only the last component may carry a decimal fraction with \",\" or \".\".","profile \"rfc3339-appendix-a\": the RFC 3339 ABNF: integer components only, contiguous runs (Y[M[D]], M[D], D; H[M[S]], M[S], S) or nW alone.","claim.well_formed is required. With false no other claim field is allowed and the check passes only when the text is not a duration of the profile.","Syntax failure reports position: the index in code points of the first code point at which the text stops being a prefix of any well-formed duration, or the text length when it ends early (reason syntax_error).","Component claims (years, months, weeks, days, hours, minutes, seconds) are exact non-negative decimals compared by value; an absent component is 0.","Derived claims keep calendar and elapsed time separate: calendar_months = 12 * years + months, calendar_days = 7 * weeks + days, time_nanoseconds = 10^9 * (3600 * hours + 60 * minutes + seconds), exact decimals.","Comparison order: well_formed, years, months, weeks, days, hours, minutes, seconds, calendar_months, calendar_days, time_nanoseconds; actual values are canonical decimals (no leading or trailing zeros, \".\" as decimal sign)."],"limits":{"max_duration_chars":100,"max_claim_chars":100},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["duration","profile","claim"],"properties":{"duration":{"type":"string","maxLength":100},"profile":{"type":"string","enum":["iso8601-1-2019","rfc3339-appendix-a"]},"claim":{"type":"object","additionalProperties":false,"required":["well_formed"],"properties":{"well_formed":{"type":"boolean"},"years":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"months":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"weeks":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"days":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"hours":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"minutes":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"seconds":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"calendar_months":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"calendar_days":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]},"time_nanoseconds":{"anyOf":[{"type":"integer","minimum":0},{"type":"string","minLength":1,"maxLength":100,"pattern":"^[0-9]+(\\.[0-9]+)?$"}]}}}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","profile","reference_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"syntax_error","well_formed_mismatch","component_mismatch","derived_mismatch"]},"first_discrepancy":{"type":["object","null"],"additionalProperties":false,"required":["field","claimed","actual","position"],"properties":{"field":{"type":"string","enum":["well_formed","years","months","weeks","days","hours","minutes","seconds","calendar_months","calendar_days","time_nanoseconds"]},"claimed":{"type":"string"},"actual":{"type":"string"},"position":{"type":["integer","null"],"minimum":0}}},"profile":{"type":"string","enum":["iso8601-1-2019","rfc3339-appendix-a"]},"reference_version":{"type":"string"}}},"examples":[{"input":{"duration":"P3Y6M4DT12H30M5S","profile":"iso8601-1-2019","claim":{"well_formed":true,"years":3,"months":6,"days":4,"hours":12,"minutes":30,"seconds":5,"calendar_months":42}},"output":{"valid":true,"reason":null,"first_discrepancy":null,"profile":"iso8601-1-2019","reference_version":"ISO 8601-1:2019 durations (designator format) + RFC 3339 (2002) timestamps; r66-duration-claim-verifiers@1.0.0"}},{"input":{"duration":"PT1M","profile":"iso8601-1-2019","claim":{"well_formed":true,"months":1}},"output":{"valid":false,"reason":"component_mismatch","first_discrepancy":{"field":"months","claimed":"1","actual":"0","position":null},"profile":"iso8601-1-2019","reference_version":"ISO 8601-1:2019 durations (designator format) + RFC 3339 (2002) timestamps; r66-duration-claim-verifiers@1.0.0"}},{"input":{"duration":"P1Y1D","profile":"rfc3339-appendix-a","claim":{"well_formed":true}},"output":{"valid":false,"reason":"syntax_error","first_discrepancy":{"field":"well_formed","claimed":"true","actual":"false","position":4},"profile":"rfc3339-appendix-a","reference_version":"ISO 8601-1:2019 durations (designator format) + RFC 3339 (2002) timestamps; r66-duration-claim-verifiers@1.0.0"}}],"execute_url":"/v1/tools/iso-duration-structure-check/versions/1.0.0/execute"}