# weekdayRange()

Source: https://findproxyforurl.net/functions/weekdayrange/ · last updated 2026-10-11

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

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

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

```js
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](https://findproxyforurl.net/check/) 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](https://findproxyforurl.net/check/) and pick the Windows (WinHTTP) profile to see the Windows answer.


## Engine notes

- chromium: Supports wrap-around ranges such as FRI to MON. (source: lab, verified 2026-10-11)
- firefox: Supports wrap-around ranges. (source: lab, verified 2026-10-11)
- pacparser: No wrap-around: a range like FRI to MON never matches. (source: 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. (source: lab, verified 2026-10-11)

## 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.

