◐ Shell
clean mode source ↗

regression: fs.utimes/futimes for dates before unix epoch

As of Node v4, fs.utimes and fs.utimes are truncating the atime and mtime values to a positive integer.

This is incorrect, and makes it impossible to set atime and mtime values before 1970-01-01T00:00:00.000Z without creating a Date object.

It looks like this is the culprit:

function toUnixTimestamp(time) {
  // eslint-disable-next-line eqeqeq
  if (typeof time === 'string' && +time == time) {
    return +time;
  }
  if (Number.isFinite(time)) {
    if (time < 0) {
      return Date.now() / 1000;