weekdayRange()

True on the given weekday or within the weekday range (SUN, MON, ... SAT). Local time unless "GMT" is passed.

weekdayRange(wd1 [, wd2] [, "GMT"])  →  boolean

Not used in the real PAC files of the PAC file statistics.

Time-dependent PACs are hard to test and behave differently per engine; the checker evaluates them at a fixed “now” so results are reproducible.

Example

if (weekdayRange("MON", "FRI")) {
  return "PROXY proxy.corp.example:8080";
}

A weekday range across the weekend matches in the browsers but not in pactester

weekdayRange("FRI", "MON") wraps around the weekend in Chrome, Edge and Firefox. pactester (pacparser) never matches such a range, so a test shows a different branch than the browsers take. Write it as weekdayRange("FRI", "SAT") || weekdayRange("SUN", "MON") to get the same answer everywhere. The PAC file tester flags ranges like this.

Windows accepts only upper-case day names

Windows (WinHTTP) understands "MON" but not "mon": weekdayRange("mon", "fri") raised an error that ended the script, and weekdayRange("Sun") was false on a Sunday. The range weekdayRange("FRI", "MON") does wrap there, as in the browsers. Write day names in upper case. Paste your file into the PAC file tester and pick the Windows (WinHTTP) profile to see the Windows answer.

Check how your own file behaves with the PAC file tester: switch the engine profile between Chromium, Firefox, pacparser and Windows and compare the trace. All engine differences are collected in pactester vs Chrome and Firefox.

Engine notes

EngineBehaviourSource
chromiumSupports wrap-around ranges such as FRI to MON.lab, verified 2026-10-11
services/proxy_resolver/pac_js_library.h@cb6eb0e7
firefoxSupports wrap-around ranges.lab, verified 2026-10-11
netwerk/base/ascii_pac_utils.js@3f73c528
pacparserNo wrap-around: a range like FRI to MON never matches.lab, verified 2026-10-11
src/pac_utils.h@v1.5.3
winhttpUpper-case day names only: "mon" raised an error, "Sun" gave false. Wraps around the weekend (FRI to MON). Lower-case "gmt" as the last argument was accepted. No argument, null or more than three arguments raise an error.lab, verified 2026-10-11
Windows 11 25H2

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.1
winhttp
11-25H2
wininet
11-25H2
reference
all
weekdayRangeyesyesyesyesyesyesyesyes

Related rules

Frequently asked questions

Does weekdayRange("FRI", "MON") work?

In Chrome, Edge, Firefox and Windows (WinHTTP) it does; the range wraps around the weekend. In pactester (pacparser) it never matches. Write weekdayRange("FRI", "SAT") || weekdayRange("SUN", "MON") to get the same answer in every engine.

Last updated: