Let's be nice and sort each day in order

Now that all the calendar entries, both one-time and recurring, have been assembled for the day, they are sorted. We begin with the all-day activities, which are sorted alphabetically, and then proceed with the calendar entries that occur at a specific time, sorted by time ascending:

 if (activities_today.length) { activities_logged_today = true; var comparator = function(first, second) { if (first.all_day && second.all_day) { if (first.description < second.description) { return -1; } else if (first.description === second.description) { return 0; } else { return 1; } } else if (first.all_day && !second.all_day) { return -1; } else if (!first.all_day && second.all_day) { return 1; } else { if (first.hour ...

Get React: Building Modern Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.