Skip to main content

Function: hours()

hours(from, to): TimeCover

Defined in: extensions/features/time-shading-covers.ts:130

hours('17:00', '07:00') wraps midnight — the common case, not the edge case. Walks days one ahead of window.start so an overnight band that starts the evening before still reaches in, and resolves each day's two boundaries through ZonedTime.fromPlain alone (no arithmetic of its own): DST is fromPlain's answer, not this builder's (time/zone.ts, disambiguation: 'compatible') — the band measures 13 hours on a short day and 15 on a long one, and a plain time that does not exist that day (the spring-forward gap) resolves forward. Hides above 'hour'.

Equal readings shade nothing: hours('09:00', '09:00') names a band of no width, and the wrap fires only when to reads earlier than from (#404 review). Reading equal as a wrap would shade all 24 hours instead — the opposite of what the call says.

Parameters​

from​

string

to​

string

Returns​

TimeCover