From 6d76fb88b9cb4e2d4ebcdac2f2f7889984463c69 Mon Sep 17 00:00:00 2001 From: wyna Date: Sun, 8 Sep 2024 17:48:19 +0200 Subject: [PATCH] conditional datePurchased --- src/components/ListItem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ListItem.jsx b/src/components/ListItem.jsx index ebf7d11..1b7334e 100644 --- a/src/components/ListItem.jsx +++ b/src/components/ListItem.jsx @@ -13,7 +13,7 @@ export function ListItem({ name, listPath, id, isChecked, datePurchased }) { useEffect(() => { const today = new Date().getTime(); - const datePurchasedInMillis = datePurchased.toMillis(); + const datePurchasedInMillis = datePurchased?.toMillis(); if (isChecked && today - datePurchasedInMillis >= ONE_DAY_IN_MILLISECONDS) { updateItem(listPath, id, !isChecked);