Fixed default value for ordering correctly (#6372)

pull/6378/head^2
Alex van Andel 2023-01-10 16:06:53 +00:00 committed by GitHub
parent 9cb9ce2e42
commit 6c5ae0b4d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -38,7 +38,7 @@ async function leastRecentlyBookedUser<T extends Pick<User, "id">>({
const userIdAndAtCreatedPair = usersWithLastCreated.reduce( const userIdAndAtCreatedPair = usersWithLastCreated.reduce(
(keyValuePair: { [key: number]: Date }, user) => { (keyValuePair: { [key: number]: Date }, user) => {
keyValuePair[user.id] = user.bookings[0]?.createdAt; keyValuePair[user.id] = user.bookings[0]?.createdAt || new Date(0);
return keyValuePair; return keyValuePair;
}, },
{} {}