💼 This rule is enabled in the ✅ recommended
config.
🔧 This rule is automatically fixable by the --fix
CLI option.
The Date
constructor can clone a Date
object directly when passed as an argument, making timestamp conversion unnecessary.
Note: Before ES2015,
new Date(date)
converteddate
to a string first, so it's not safe to clone.
// ❌
new Date(date.getTime());
// ✅
new Date(date);