enligth today birthdays
This commit is contained in:
@@ -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
|
||||
}, [])
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user