Skip to content

fs.utimes truncate date #13520

Closed
Closed
@buckle2000

Description

@buckle2000

Version: v6.10.3
Platform: Windows 10 64-bit
Subsystem: fs
Disk format: NTFS

This issue is related to #13255 .

let fs = require('fs');
let src = 'path/to/src';
let src_stats = fs.statSync(src);
let dest = 'path/to/dest'
if (fs.existsSync(dest)) {
  fs.utimesSync(dest, src_stats.atime, src_stats.mtime);
}
let dest_stats = fs.statSync(dest);
console.log(src_stats.mtime);
console.log(dest_stats.mtime);
console.log(src_stats.mtime == dest_stats.mtime);

output:

2017-05-11T06:35:33.501Z
2017-05-11T06:35:33.000Z
false

So the millisecond part of mtime is discarded when setting the time but not when getting the time.
Why is this inconsistent?

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.fsIssues and PRs related to the fs subsystem / file system.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions