timeRange()

True if the current time is within the given hour/minute/second range.

timeRange(hour | hour, min | hour, min, sec ... [, "GMT"])  →  boolean

Local time unless “GMT” is passed. The checker evaluates time functions at a fixed “now” you can set, so results are reproducible.

Example

if (timeRange(8, 18)) {
  return "PROXY proxy.corp.example:8080";
}

Engine notes

EngineBehaviourSource
chromiumSupports wrap-around ranges such as 22 to 6.code, verified 2026-10-04
services/proxy_resolver/pac_js_library.h@cb6eb0e7
pacparserNo wrap-around ranges.code, verified 2026-10-04
src/pac_utils.h@v1.5.3

Availability

Derived from each engine's vendored helper library plus its native bindings (see engines).
Functionchromium
<=51
chromium
>=52
firefox
all
pacparser
<=1.4.6
pacparser
1.5.0
pacparser
>=1.5.1
reference
all
timeRangeyesyesyesyesyesyesyes

Related rules