TimeSpan¶
Use the TimeSpan Rule Type when a field should contain a duration (e.g., hours and minutes). The rule parses common duration formats, validates them, and normalizes the result for downstream use.
When to use¶
- Durations on timesheets, SLAs, call logs, and process timings.
- Any field expected to hold elapsed time rather than a date or clock time.
- Normalizing diverse inputs like β1h 30mβ, β90 minsβ, or β01:30β into a consistent output.
Open Field Configuration¶
See Field Rules (Rules Engine) for how to open the field configuration:
- From the document overlay (supported services), or
- From the Fields panel on the right sidebar.
Configure the TimeSpan rule¶
Core settings:
- Rule Type: TimeSpan
- Default Value: The value to return when nothing is extracted (e.g., Empty Text).
This rule has a simple configuration. All behavior focuses on recognizing common duration inputs and returning a normalized result.
Input parsing and normalization¶
Accepted patterns (examples):
- Colon formats
- HH:mm (e.g., 02:15)
- HH:mm:ss (e.g., 02:15:30)
- H:mm or m:ss (e.g., 8:05, 3:07)
- Unit-based text
- β1h 30mβ, β1 hr 30 minβ, β90mβ, β90 minutesβ, β2 hoursβ
- β5400sβ, β45 secβ, β45 secondsβ
- Mixed
- β1h 30β, β1:30hβ, β01:30 hoursβ (where units are present)
Normalization rules:
- Whitespace and punctuation noise are trimmed.
- Unit variants are standardized (e.g., hr, h β hours; m, min β minutes; s, sec β seconds).
- If seconds are omitted, they normalize to 00.
- Ambiguities like β1:30β are interpreted as HH:mm by default.
Ambiguous inputs
Inputs such as β1:30β can mean 1 hour 30 minutes or 1 minute 30 seconds depending on context. By default, they are parsed as HH:mm. If your process expects mm:ss, set a review policy for these cases.
Output and formatting¶
Standard output (recommended):
- Canonical string in HH:mm:ss (zeroβpadded), for example:
- 00:45:00
- 02:15:30
- 36:00:00 (durations can exceed 24 hours if the source implies longer spans)
Alternative outputs (downstream):
- Store the canonical HH:mm:ss, then derive totals where needed:
- TotalMinutes (integer/decimal)
- TotalSeconds (integer)
- Humanβreadable labels (β2h 15mβ for UI)
Why HH:mm:ss?
A uniform, zeroβpadded HH:mm:ss travels well across systems, avoids locale surprises, and is easy to convert into totals.
HITL triggers and reviewer guidance¶
Trigger review when:
- The value cannot be parsed as a duration (unknown pattern or conflicting units).
- The value is clearly out of policy (e.g., negative duration, or unexpectedly large if your process caps durations).
- Ambiguous formats appear (e.g., β1:30β with no context and your policy requires explicit units).
Reviewer note suggestion:
- βConfirm the duration format. If ambiguous (e.g., 1:30), interpret as HH:mm unless the document indicates mm:ss. Normalize to HH:mm:ss.β
Examples¶
-
Hours and minutes
- Input: β1h 30mβ β Output: 01:30:00
- Input: β01:30β β Output: 01:30:00
-
Hours, minutes, seconds
- Input: β2:15:30β β Output: 02:15:30
-
Minutes only
- Input: β90 minutesβ β Output: 01:30:00
-
Seconds only
- Input: β5400sβ β Output: 01:30:00
-
Long span (allowed)
- Input: β36 hoursβ β Output: 36:00:00
-
Ambiguous (consider review)
- Input: β1:30β β Default interpretation: 01:30:00; escalate if your process expects mm:ss.
Best practices¶
- Standardize on HH:mm:ss for storage; convert to totals or humanβreadable strings at the edges.
- Decide how to handle ambiguous βm:ssβ vs βH:mmβ and write it into your reviewer guidance.
- If your workflow has min/max limits, document them and route outβofβrange values to HITL.
- Avoid auto-correcting suspect OCR (e.g., βl:30β vs β1:30β) unless you have high confidence.
Testing checklist¶
- [ ] HH:mm, HH:mm:ss, and H:mm inputs across typical ranges.
- [ ] Unit-based inputs (h/hr, m/min, s/sec), including pluralization and spacing variants.
- [ ] Large durations (>24h) if your process expects them.
- [ ] Ambiguous values (e.g., 1:30) and your chosen handling policy.
- [ ] Negative or zero durations if applicable to your process (e.g., disallow negatives).
Troubleshooting¶
-
Wonβt parse
- Check for unsupported symbols/typos; ensure units are recognizable or provide a colon format.
-
Interpreted as mm:ss instead of HH:mm (or vice versa)
- Add reviewer guidance or preβclassification to disambiguate; prefer explicit units in source templates if possible.
-
Unexpectedly large or small output
- Confirm the source didnβt mix units (e.g., β1m 90sβ expected β 02:30). Add HITL when totals exceed expected ranges.
UI reference¶
- Base panel (Rule Type, Default Value)