# dateRange and timeRange are always false on Windows

Source: https://findproxyforurl.net/articles/pac-time-functions-windows/ · updated 2026-10-11

Changed 2026-10-11: New article: dateRange and timeRange are always false on Windows, so time-based rules never apply to Windows programs; what works instead and how to test it.

A PAC file can choose a proxy by date or time of day with dateRange() and timeRange(). Chrome, Edge and Firefox follow these rules. Windows services and Windows programs never do, because on Windows both functions always return false.

*Source for every statement on this page: lab, Windows 11 25H2, 2026-10-11.*

## What was observed: dateRange and timeRange never return true on Windows

A PAC file (proxy auto-config file, often `proxy.pac` or `wpad.dat`) is a small JavaScript program
that tells a client which proxy to use. It has three helper functions for time:
[dateRange()](https://findproxyforurl.net/functions/daterange/) for days, months and years,
[timeRange()](https://findproxyforurl.net/functions/timerange/) for the time of day, and
[weekdayRange()](https://findproxyforurl.net/functions/weekdayrange/) for days of the week.

On Windows, `dateRange()` and `timeRange()` returned false for every form of argument that was
tried. That includes calls that cover the current date or time in any case, such as
`dateRange(2020, 2030)`, `dateRange("JAN", "DEC")`, `timeRange(0, 24)` and the forms with minutes,
seconds or `"GMT"`. `weekdayRange()` works on Windows, also across the weekend, but only with
upper-case day names such as `"MON"`. A lower-case name such as `"mon"` makes it throw an error,
and that stops the script.

## What it means: time-based rules silently never apply to Windows programs

The Windows engine is used by Windows services, the background download service BITS, and programs
that use the Windows proxy settings through WinHTTP, WinINet, .NET or Java. For all of them, a branch
that needs `dateRange()` or `timeRange()` to be true is never taken, and no error appears anywhere.
Chrome, Edge and Firefox run their own engine, also on Windows, and there the same branch is taken
when the date or time is in range. The same file therefore sends browsers and Windows programs to
different places, and only at the times the rule was written for.

## What to do: keep the time policy out of the PAC file

- **Apply time-based policy on the proxy.** The proxy knows the time and applies the rule the same
  way for every client, whatever engine runs the PAC file.
- **Make the answer without the time rule the safe one.** If the time rule has to stay in the file,
  write it so that the branch Windows takes, the one where the time function is false, gives an
  answer you accept.
- **Write day names in upper case.** `weekdayRange("MON", "FRI")` works on Windows and in the
  browsers; `weekdayRange("mon", "fri")` stops the script on Windows.

The rule [PAC-K007](https://findproxyforurl.net/rules/time-functions-usage/) covers time ranges that differ between engines.
Other ways in which Windows runs PAC files differently are summarised in
[Windows runs PAC files differently from Chrome and Firefox](https://findproxyforurl.net/articles/pac-on-windows/).

## Test the file with the Windows profile

Paste your file into the [PAC file tester](https://findproxyforurl.net/check/), enter a URL and pick the profile
"Windows WinHTTP" (system services, BITS) or "Windows WinINet" (desktop apps,
.NET, Java). The trace shows which branch Windows
takes when `dateRange()` and `timeRange()` are false. The engine page for
[Windows (WinHTTP)](https://findproxyforurl.net/engines/winhttp/) lists the other differences.


## Frequently asked questions

### Does dateRange work in a PAC file on Windows?

No. On Windows 11 25H2, dateRange() returned false for every form of argument that was tried, including dateRange(2020, 2030) and dateRange("JAN", "DEC"), which cover the current date. A rule that depends on it never applies to Windows services or Windows programs.

### Why is timeRange always false in WinHTTP?

The Windows PAC engine returns false from timeRange() whatever the arguments are, even for timeRange(0, 24), which covers the whole day. Chrome, Edge and Firefox return true for that call. Do the time-based part of the policy on the proxy instead.

### Does weekdayRange work on Windows?

Yes, but only with upper-case day names such as "MON" and "FRI". Ranges across the weekend such as weekdayRange("FRI", "MON") work too. A lower-case name such as "mon" makes the call throw an error, and that stops the whole script.

### How do I make a time-based PAC rule work on Windows?

Move the time rule to the proxy, which knows the time and applies it the same way for every client. If it has to stay in the PAC file, write the file so that the branch Windows takes when the time function is false is an answer you accept, and test it with a Windows profile at findproxyforurl.net/check/.

