Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Fix datelib test

Matt Kilgore91851b433357
diff --git a/frontend/lib/datelib/datelib.test.ts b/frontend/lib/datelib/datelib.test.ts
index 5fa81711..0504de6b 100644
--- a/frontend/lib/datelib/datelib.test.ts
+++ b/frontend/lib/datelib/datelib.test.ts
@@ -31,7 +31,10 @@ describe("factorRange", () => {
// End should be 10 days from now
expect(end).toBeInstanceOf(Date);
- expect(end.getFullYear()).toBe(new Date().setDate(new Date().getDate() + 10).getFullYear());
+ // Set the future date so it works even in late december when the year changes
+ let futureDate = new Date()
+ futureDate.setDate(futureDate.getDate()) + 10
+ expect(end.getFullYear()).toBe(futureDate.getFullYear());
});
});
@@ -40,4 +43,4 @@ describe("parse", () => {
const date = parse("2020-02-01");
expect(date).toBeInstanceOf(Date);
});
-});
+});
\ No newline at end of file