How can I get the number of days left until next birthday from this array of objects?
const people = [
{ name: 'Bill', dob: new Date('07/11/1949') },
{ name: 'Will', dob: new Date('02/21/1979') }
]
So basically I need how many days there are from today until the birth date.
I tried to extract the month and day from the dob like this:
for (let i = 0; i < people.length; i++) {
const personDob = people[i].dob
const personBirthMonth = new Date(personDob).getMonth() + 1
const personDayOfBirth = new Date(personDob).getUTCDate() +1
}
I've checked this post but I'm kind of confused because I don't need to compare the full year, only the months and days I guess.
I'm not sure how to get the remaining days left.