From 9c87e6f7ccd1a42e1433bfd58a9f1b08c46c9e70 Mon Sep 17 00:00:00 2001 From: Romulus21 Date: Sun, 31 Dec 2023 16:24:51 +0100 Subject: [PATCH] enligth today birthdays --- src/App.tsx | 2 +- src/components/BirthdayList.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e366641..5ebe6c0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -34,7 +34,7 @@ function App() { const sortPersons = (birthdays: Birthday[]) => { birthdays = birthdays.reduce((result: Birthday[], item: Birthday) => { const birthday = `${(new Date()).getFullYear()}-${pad(item.month)}-${pad(item.day)}` - item.birthday = (new Date()).toISOString().split('T')[0] < birthday ? birthday : `${(new Date()).getFullYear() + 1}-${pad(item.month)}-${pad(item.day)}` + item.birthday = (new Date()).toISOString().split('T')[0] <= birthday ? birthday : `${(new Date()).getFullYear() + 1}-${pad(item.month)}-${pad(item.day)}` result.push(item) return result }, []) diff --git a/src/components/BirthdayList.tsx b/src/components/BirthdayList.tsx index be84b85..a99e2b5 100644 --- a/src/components/BirthdayList.tsx +++ b/src/components/BirthdayList.tsx @@ -19,7 +19,7 @@ const BirthdayList: FC = ({birthdays, selectedPerson, selectP ) } content.push(
  • + className={`${selectedPerson?.id === birthday.id ? 'bg-blue-400' : ((new Date).getDate() === birthday.day && ((new Date).getMonth() + 1) === birthday.month ? 'bg-yellow-500 py-1' : '')} hover:bg-blue-300 flex gap-2 flex-wrap`}>
    selectPerson(birthday)}> {birthday.name}