| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I mean, comparing Date objects does work in JavaScript: new Date >= new Date; // true
new Date <= new Date; // true
new Date < new Date; // false
new Date > new Date; // false
new Date('1970-01-01') < new Date('2038-01-19'); // true
new Date('1970-01-01') > new Date('2038-01-19'); // false
// Equality on the other hand doesn't work
new Date == new Date // false
new Date('1970-01-01') == new Date('1970-01-01') // false |
Sorry, something went wrong.
|
Well, here the idea is to know whether a file has been modified by comparing modified times. if (prev.mtime !== curr.mtime) {
console.log("The file has been modified!")
}
which doesn't work. Actually that's the root cause of a bug I just fixed. |
Sorry, something went wrong.
|
Keep in mind that "compare X and Y" does not mean "apply a JS comparison operator between X and Y"; for example, X.getTime() === Y.getTime() is a way to compare X and Y. In any case, this can be sidestepped by just referring to curr.mtimeMs and prev.mtimeMs instead of curr.mtime and prev.mtime :) |
Sorry, something went wrong.
The current wording suggests to compare Date objects, which won't work.
The current wording suggests to compare Date objects, which won't work. PR-URL: #40134 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
The current wording suggests to compare Date objects, which won't work. PR-URL: #40134 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
| Back | FazBrowse Home | New Git URL |
The current wording suggests to compare Date objects, which won't work.