summaryrefslogtreecommitdiff
path: root/std/testing/asserts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/testing/asserts.ts')
-rw-r--r--std/testing/asserts.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/std/testing/asserts.ts b/std/testing/asserts.ts
index aa3017a4c..b7377c1bc 100644
--- a/std/testing/asserts.ts
+++ b/std/testing/asserts.ts
@@ -95,6 +95,13 @@ export function equal(c: unknown, d: unknown): boolean {
return String(a) === String(b);
}
if (a instanceof Date && b instanceof Date) {
+ const aTime = a.getTime();
+ const bTime = b.getTime();
+ // Check for NaN equality manually since NaN is not
+ // equal to itself.
+ if (Number.isNaN(aTime) && Number.isNaN(bTime)) {
+ return true;
+ }
return a.getTime() === b.getTime();
}
if (Object.is(a, b)) {