JS/TypeScript Generate times between hours

Viewed 1104

So let's say we have two times:

7:30 - 12:00

So my question is how can I generate an array with times like this:

7:30, 8:00, 8:30, 9:00, 9:30, 10:00, 10:30, 11:00, 11:30

I need this for a booking, so let's say the business will open at 7:30 and every booking that you can make will be 30 min(this time can change, could be one hour or more)

Whats the best way to generate something like this in JS?

3 Answers
Related