weekdayRange()
True on the given weekday or within the weekday range (SUN, MON, ... SAT). Local time unless "GMT" is passed.
weekdayRange(wd1 [, wd2] [, "GMT"]) → booleanTime-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
| Engine | Behaviour | Source |
|---|---|---|
| chromium | Supports wrap-around ranges such as FRI to MON. | lab, verified 2026-10-11 |
| firefox | Supports wrap-around ranges. | lab, verified 2026-10-11 |
| pacparser | No wrap-around: a range like FRI to MON never matches. | lab, verified 2026-10-11 |
| winhttp | Upper-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 |
Availability
| Function | chromium | chromium | firefox | pacparser | pacparser | winhttp | wininet | reference |
|---|---|---|---|---|---|---|---|---|
weekdayRange | yes | yes | yes | yes | yes | yes | yes | yes |
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.