diff --git a/src/components/metadata/CollectionSection.tsx b/src/components/metadata/CollectionSection.tsx index 2b57f58c..7d85c9c0 100644 --- a/src/components/metadata/CollectionSection.tsx +++ b/src/components/metadata/CollectionSection.tsx @@ -116,6 +116,17 @@ export const CollectionSection: React.FC = ({ } }; + // Sort collection movies by year (oldest to newest) + const sortedCollectionMovies = React.useMemo(() => { + if (!collectionMovies) return []; + + return [...collectionMovies].sort((a, b) => { + const yearA = a.year ? parseInt(a.year.toString()) : 0; + const yearB = b.year ? parseInt(b.year.toString()) : 0; + return yearA - yearB; // Oldest to newest + }); + }, [collectionMovies]); + const renderItem = ({ item }: { item: StreamingContent }) => ( = ({ {collectionName} item.id} horizontal