Skip to content

Commit bab0fc6

Browse files
author
Nika Kolesnikova
committed
fix: remove redundant else block from calculateIsPurchased function; fix typo in "database"
1 parent f565e6f commit bab0fc6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/components/AddItems.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function AddItems({ items }) {
4848
`${itemName} was added to the list! The next purchase date is set to ${daysUntilNextPurchase} days from now.`,
4949
);
5050
} catch (error) {
51-
alert(`Item was not added to the itemsbase, Error: ${error.message}`);
51+
alert(`Item was not added to the database, Error: ${error.message}`);
5252
} finally {
5353
event.target.reset();
5454
}

src/components/ListItem.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ const currentDate = new Date();
88
const calculateIsPurchased = (dateLastPurchased) => {
99
if (!dateLastPurchased) {
1010
return false;
11-
} else {
12-
const purchaseDate = dateLastPurchased.toDate();
13-
const oneDayLater = new Date(
14-
purchaseDate.getTime() + ONE_DAY_IN_MILLISECONDS,
15-
);
16-
return currentDate < oneDayLater;
1711
}
12+
const purchaseDate = dateLastPurchased.toDate();
13+
const oneDayLater = new Date(
14+
purchaseDate.getTime() + ONE_DAY_IN_MILLISECONDS,
15+
);
16+
17+
return currentDate < oneDayLater;
1818
};
1919

2020
export function ListItem({ item, listPath }) {

0 commit comments

Comments
 (0)