fs.utimes Infinity support is misdocumented or regressed #15453
Description
- Version: 8.5.0
- Platform: Windows
- Subsystem: fs
Potentially related to #14017.
Take this code:
fs.utimes(path, Infinity, 0)
(I needed to set the mtime to some point in the past for make
’s sake so it wouldn’t consider a broken file to be up to date and would try again. Not sure quite why I wrote Infinity
for the atime rather than Date.now() / 1000
, though I believe they were equivalent.)
The fs.utimes
documentation is inconsistent on how infinities should be handled:
In its history, it says that in v4.1.0, “Numeric strings, NaN
and Infinity
are now allowed time specifiers.” There is no note saying that NaN
and Infinity
are no longer permitted from such-and-such a version, yet the function documentation says “If the value is NaN
, Infinity
or -Infinity
, an Error will be thrown.”
Either the history should be updated to indicate when infinties became illegal again, or this is a regression.
This worked on some Node 4 version, but it’s not working on 8.5.0 (I just upgraded).