generate date array from x-date to y-date

For a calendar i require to generate an array of dates from 2023-01-01 till 2023-01-15. I’ve tried to generate the array using a loop-over, however I think the code could be much cleaner.

I would’ve expected javascript to have an getDateArray(new Date(), new Date('2023-01-15')) function but it doesn’t.