From fd2e0020cd4896f08673fc561ab3dab50df92153 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 20 May 2024 12:31:12 +0100 Subject: [PATCH] Fix more date math problems. --- packages/server/src/api/routes/tests/search.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/routes/tests/search.spec.ts b/packages/server/src/api/routes/tests/search.spec.ts index 93cd9fdfcd..b8f62ad4a5 100644 --- a/packages/server/src/api/routes/tests/search.spec.ts +++ b/packages/server/src/api/routes/tests/search.spec.ts @@ -249,9 +249,13 @@ describe.each([ let globalUsers: any = [] const serverTime = new Date() + + // In MariaDB and MySQL we only store dates to second precision, so we need + // to remove milliseconds from the server time to ensure searches work as + // expected. serverTime.setMilliseconds(0) - const future = new Date(serverTime.getTime()) - future.setDate(future.getDate() + 30) + + const future = new Date(serverTime.getTime() + 1000 * 60 * 60 * 24 * 30) const rows = (currentUser: User) => { return [