I have an array of objects that I need to split into chunks of 2 hours each, starting on the hour (e.g. 10.00 - 12.00, 12.00 - 14.00, etc).
Here is my current solution, but I feel like it may not be the most efficient:
Please consider the day
variable, which is defined as moment().startOf('day')
I'm open to a Lodash approach if anyone has one.
Example data:
// array of objects with eventStart timestamps
Expected output:
// chunks of data split into 2-hour intervals
Here is a simplified version of the code for the question:
// code snippet
// JavaScript code