# dateRange()

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

`dateRange(day | month | year ... [, "GMT"])` → boolean

True if the current date is within the given day, month and/or year range.

Accepts many argument forms (day, month, year, or ranges of them). Local time unless "GMT" is the last argument.

## Example

```js
if (dateRange("DEC", "JAN")) {
  return "PROXY proxy-holiday.corp.example:8080";
}
```

## A date range across the new year matches in the browsers but not in pactester

`dateRange("DEC", "JAN")` wraps around the new year in Chrome, Edge and Firefox. pactester
(pacparser) never matches such a range, so the example above would never pick the holiday proxy
in a pactester test. `dateRange("DEC") || dateRange("JAN")` works the same in Chrome, Edge,
Firefox and pactester. The [PAC file tester](https://findproxyforurl.net/check/) flags ranges like this.

## dateRange is never true on Windows

In Windows (WinHTTP) `dateRange` returned false for every one of the fourteen argument forms
tried, including `dateRange(1, 31)` and the current year. A branch that depends on it never
runs for Windows programs. If the date matters, make the decision on the proxy instead.
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 DEC to JAN. (source: lab, verified 2026-10-11)
- firefox: Supports wrap-around ranges. (source: lab, verified 2026-10-11)
- pacparser: No wrap-around ranges. (source: lab, verified 2026-10-11)
- winhttp: Always false, whatever the arguments (14 forms tested, including dateRange(1, 31) and the current year). (source: lab, verified 2026-10-11)

## Frequently asked questions

### Does dateRange("DEC", "JAN") work across the new year?

In Chrome, Edge and Firefox it does. In pactester (pacparser) it never matches. Split it into dateRange("DEC") || dateRange("JAN") to get the same answer in those engines. On Windows (WinHTTP) dateRange is never true at all.

### Why does dateRange never match on Windows?

Windows (WinHTTP) returns false from dateRange whatever the arguments are, so the date branch of a PAC file never runs in Windows programs. Splitting the range does not help. Move the date-dependent decision to the proxy, or write the file so that its result does not depend on the date.

