✅ This rule is part of the recommended config.
🔧 This rule is auto-fixable.
Date.now()
is shorter and nicer than new Date().getTime()
, and avoids unnecessary instantiation of Date
objects.
const foo = new Date().getTime();
const foo = new Date().valueOf();
const foo = +new Date;
const foo = Number(new Date());
const foo = new Date() * 2;
const foo = Date.now();
const foo = Date.now() * 2;