enligth today birthdays
This commit is contained in:
@@ -34,7 +34,7 @@ function App() {
|
|||||||
const sortPersons = (birthdays: Birthday[]) => {
|
const sortPersons = (birthdays: Birthday[]) => {
|
||||||
birthdays = birthdays.reduce((result: Birthday[], item: Birthday) => {
|
birthdays = birthdays.reduce((result: Birthday[], item: Birthday) => {
|
||||||
const birthday = `${(new Date()).getFullYear()}-${pad(item.month)}-${pad(item.day)}`
|
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)
|
result.push(item)
|
||||||
return result
|
return result
|
||||||
}, [])
|
}, [])
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const BirthdayList: FC<BirthdayListProps> = ({birthdays, selectedPerson, selectP
|
|||||||
</li>)
|
</li>)
|
||||||
}
|
}
|
||||||
content.push(<li key={birthday.name + '-' + birthday.day + '-' + birthday.month}
|
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"
|
<div className="flex-1 cursor-pointer flex items-center pl-5"
|
||||||
onClick={() => selectPerson(birthday)}>
|
onClick={() => selectPerson(birthday)}>
|
||||||
{birthday.name}
|
{birthday.name}
|
||||||
|
|||||||
Reference in New Issue
Block a user