Fixed default value for ordering correctly (#6372)

This commit is contained in:
Alex van Andel
2023-01-10 17:06:53 +01:00
committed by GitHub
parent 9cb9ce2e42
commit 6c5ae0b4d9
+1 -1
View File
@@ -38,7 +38,7 @@ async function leastRecentlyBookedUser<T extends Pick<User, "id">>({
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;
},
{}