intervalContainsTime
Signature
Section titled “Signature”intervalContainsTime(intervalStart: string, intervalEnd: string, pointOrStart: string, pointEnd?: string): booleanReturn true when pointOrStart lies in the half-open interval [intervalStart, intervalEnd) (3-arg), or when the inner interval [innerStart, innerEnd) lies within it (4-arg).
- Half-open: an interval holds every clock time
twithstart <= t < end, sointervalEnditself is outside (the rule CORE-6’sintervalContainsuses). An empty interval (start === end) contains no point. - 4-arg: the inner interval must start at or after
intervalStart, end at or beforeintervalEnd, and overlap the outer interval. An empty inner interval therefore counts only strictly inside, never at an edge (CORE-6’sclampIntervalclamps it away there). - PlainTime has no day rollover: an interval never wraps past midnight. And because
endis excluded, no interval contains23:59:59.999999999— containing it would need anendgreater than it, and no PlainTime is. An interval may still have it as itsend:intervalContainsTime("09:00:00", "23:59:59.999999999", "23:00:00")istrue, whileintervalContainsTime("09:00:00", "23:59:59.999999999", "23:59:59.999999999")isfalse. - Uses
Temporal.PlainTime.comparefor comparison. - Returns
falseifintervalStart > intervalEnd(invalid outer interval). - Returns
falseifinnerStart > innerEndin 4-arg mode (invalid inner interval). - Returns
falseon invalid input (wrong type, malformed strings).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
intervalStart | string | ISO 8601 time string for the outer interval start |
intervalEnd | string | ISO 8601 time string for the outer interval end (excluded) |
pointOrStart | string | ISO 8601 time string for the point (3-arg) or inner start (4-arg) |
pointEnd | string | optional ISO 8601 time string for the inner interval end (4-arg mode) |
Returns
Section titled “Returns”true if the point or inner interval is contained, or false on invalid input
Examples
Section titled “Examples”import { intervalContainsTime } from "@northguild/gmt/plain/interval";
intervalContainsTime("09:00:00", "17:00:00", "12:00:00") // true