From 6c5ae0b4d972dca47f00ad5bfbd1657559dc6cc6 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Tue, 10 Jan 2023 16:06:53 +0000 Subject: [PATCH] Fixed default value for ordering correctly (#6372) --- packages/lib/server/getLuckyUser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lib/server/getLuckyUser.ts b/packages/lib/server/getLuckyUser.ts index b7b458bda9..26f3f65436 100644 --- a/packages/lib/server/getLuckyUser.ts +++ b/packages/lib/server/getLuckyUser.ts @@ -38,7 +38,7 @@ async function leastRecentlyBookedUser>({ const userIdAndAtCreatedPair = usersWithLastCreated.reduce( (keyValuePair: { [key: number]: Date }, user) => { - keyValuePair[user.id] = user.bookings[0]?.createdAt; + keyValuePair[user.id] = user.bookings[0]?.createdAt || new Date(0); return keyValuePair; }, {}