dateRange()
True if the current date is within the given day, month and/or year range.
dateRange(day | month | year ... [, "GMT"]) → booleanAccepts many argument forms (day, month, year, or ranges of them). Local time unless “GMT” is the last argument.
Example
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 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 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 DEC to JAN. | lab, verified 2026-10-11 |
| firefox | Supports wrap-around ranges. | lab, verified 2026-10-11 |
| pacparser | No wrap-around ranges. | lab, verified 2026-10-11 |
| winhttp | Always false, whatever the arguments (14 forms tested, including dateRange(1, 31) and the current year). | lab, verified 2026-10-11 |
Availability
| Function | chromium | chromium | firefox | pacparser | pacparser | winhttp | wininet | reference |
|---|---|---|---|---|---|---|---|---|
dateRange | yes | yes | yes | yes | yes | yes | yes | yes |
Related rules
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.