enligth today birthdays

This commit is contained in:
Romulus21
2023-12-31 16:24:51 +01:00
parent 7ea2508185
commit 9c87e6f7cc
2 changed files with 2 additions and 2 deletions

View File

@@ -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
}, [])

View File

@@ -19,7 +19,7 @@ const BirthdayList: FC<BirthdayListProps> = ({birthdays, selectedPerson, selectP
</li>)
}
content.push(<li key={birthday.name + '-' + birthday.day + '-' + birthday.month}
className={`${selectedPerson?.id === birthday.id ? 'bg-blue-400' : ''} hover:bg-blue-300 flex gap-2 flex-wrap`}>
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`}>
<div className="flex-1 cursor-pointer flex items-center pl-5"
onClick={() => selectPerson(birthday)}>
{birthday.name}