diff --git a/src/components/item/ItemPage.jsx b/src/components/item/ItemPage.jsx index 0104601..4a9f9cf 100644 --- a/src/components/item/ItemPage.jsx +++ b/src/components/item/ItemPage.jsx @@ -68,9 +68,13 @@ export const ItemPage = () => { (filterPriceMin === "" || item.price >= parseFloat(filterPriceMin)) && (filterPriceMax === "" || item.price <= parseFloat(filterPriceMax)); const matchesDate = + !filterDateRange || filterDateRange.length === 0 || - (new Date(item.purchaseDate) >= filterDateRange[0] && + (filterDateRange[0] && + filterDateRange[1] && + new Date(item.purchaseDate) >= filterDateRange[0] && new Date(item.purchaseDate) <= filterDateRange[1]); + return matchesRoom && matchesName && matchesPrice && matchesDate; }); setFilteredItems(filtered); @@ -106,7 +110,55 @@ export const ItemPage = () => { return (
-
{/* Filters here */}
+
+
+ + +
+
+ + setFilterName(e.target.value)} + /> +
+
+ + setFilterPriceMin(value)} + /> + - + setFilterPriceMax(value)} + /> +
+
+ + setFilterDateRange(dates)} + value={filterDateRange} + /> +
+
{/* Button to open create item modal */}