Skip to content

Commit

Permalink
conditional datePurchased
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyna-7 committed Sep 8, 2024
1 parent 1ae8026 commit 6d76fb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/ListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6d76fb8

Please sign in to comment.