Description
Combine signed duration components and report overall sign.
Date labels and intervals depend on origins, endpoint inclusion and calendar versus elapsed-time conventions. Numeric serial periods and local token formats can represent useful bookkeeping without resolving a real instant or official fiscal rule.
Combine signed duration components and report overall sign.
When to use this tool
Use Elapsed Duration Sign Canonicalization when checking a supplied date-label, duration or interval convention.
How to use the tool and how it works
- Enter days, hours, minutes, seconds. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read totalSeconds, sign, magnitudeSeconds. Use the output convention below.
Combine signed duration components and report overall sign. totalSeconds = days*86400+hours*3600+minutes*60+seconds; return Math.sign(total) and absolute magnitude.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| days | Days | Required. Safe integer. |
| hours | Hours | Required. Safe integer. |
| minutes | Minutes | Required. Safe integer. |
| seconds | Seconds | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| totalSeconds | Total Seconds | Required. Safe integer. |
| sign | Sign | Required. Safe integer. |
| magnitudeSeconds | Magnitude Seconds | Required. Safe integer. |
{
"input": {
"days": 1,
"hours": -25,
"minutes": 0,
"seconds": 0
},
"output": {
"totalSeconds": -3600,
"sign": -1,
"magnitudeSeconds": 3600
}
} Limitations and assumptions
- Components need not have a common sign; this fixed-length arithmetic does not treat calendar months or DST days.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use a complete date/time implementation and the applicable calendar policy for actual scheduling and interval interpretation.
References
Similar or alternative tools
- ISO Duration Fractional Component Token
Split one duration component's written fields.
- ISO Duration Week Only Token
Parse a bounded week-only duration token.