If I have an unsorted array of future Date objects, what would be the best way to pick out the Date closest to the user's next birthday? For example,
const dates = [new Date(2023, 12, 23),
new Date(2023, 12, 2),
new Date(2023, 12, 6),
new Date(2023, 10, 23),
new Date(2023, 9, 10),
new Date(2023, 8, 1),
new Date(2023, 7, 4),
new Date(2023, 7, 7),
new Date(2023, 1, 1)]
findClosestDate(new Date(1995, 10, 3)); // should return dates[3]