mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-14 08:25:07 +01:00
parent
c4f68615cd
commit
e859ceed44
@ -173,17 +173,12 @@ export async function multiSearch(
|
|||||||
language: "en-US",
|
language: "en-US",
|
||||||
page: 1,
|
page: 1,
|
||||||
});
|
});
|
||||||
const currentDate = new Date();
|
// filter out results that aren't movies or shows
|
||||||
// filter out results that aren't movies or shows or are unreleased
|
const results = data.results.filter(
|
||||||
const results = data.results.filter((r) => {
|
(r) =>
|
||||||
if (r.media_type === TMDBContentTypes.MOVIE) {
|
r.media_type === TMDBContentTypes.MOVIE ||
|
||||||
return new Date(r.release_date) <= currentDate;
|
r.media_type === TMDBContentTypes.TV,
|
||||||
}
|
);
|
||||||
if (r.media_type === TMDBContentTypes.TV) {
|
|
||||||
return new Date(r.first_air_date) <= currentDate;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user