VideosList search: search by title and released

This commit is contained in:
svetlagasheva 2020-03-27 11:48:54 +02:00
parent 95ceb44255
commit 809db2ed52

View file

@ -73,7 +73,11 @@ const VideosList = ({ className, metaResource }) => {
<div className={styles['videos-scroll-container']}>
{videosForSeason
.filter((video) => {
return search.length === 0 || (typeof video.title === 'string' && video.title.toLowerCase().includes(search.toLowerCase()));
return search.length === 0 ||
(
(typeof video.title === 'string' && video.title.toLowerCase().includes(search.toLowerCase())) ||
(video.released.toLocaleString(undefined, { year: '2-digit', month: 'short', day: 'numeric' }).toLowerCase().includes(search.toLowerCase()))
);
})
.map((video, index) => (
<Video