Prefer Date.now() to get the number of milliseconds since the Unix Epoch ​
💼 This rule is enabled in the ✅ recommended config.
🔧 This rule is automatically fixable by the --fix CLI option.
Date.now() is shorter and nicer than new Date().getTime(), and avoids unnecessary instantiation of Date objects.
Fail ​
js
const foo = new Date().getTime();js
const foo = new Date().valueOf();js
const foo = +new Date;js
const foo = Number(new Date());js
const foo = new Date() * 2;Pass ​
js
const foo = Date.now();js
const foo = Date.now() * 2;