From 49e621290986ce810928c68688fc4d9ebe6dd194 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 21 Jan 2021 09:44:11 -0500 Subject: [PATCH] Use triple equals for dates Not sure what would need to be coerced here, triple equals might help ensure a more accurate diff. ```js const date1 = new Date(Date.UTC(96, 1, 2, 3, 4, 5)); console.log(date1.valueOf()); // expected output: 823230245000 const date2 = new Date("02 Feb 1996 03:04:05 GMT"); console.log(date2.valueOf()); // expected output: 823230245000 console.log(date1.valueOf() === date2.valueOf()); // expected output: true ``` --- src/diff/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diff/index.js b/src/diff/index.js index 74b961b..0c70410 100644 --- a/src/diff/index.js +++ b/src/diff/index.js @@ -13,7 +13,7 @@ const diff = (lhs, rhs) => { }, {}); if (isDate(l) || isDate(r)) { - if (l.valueOf() == r.valueOf()) return {}; + if (l.valueOf() === r.valueOf()) return {}; return r; }