Oh, thinking it should not be an issue for JavaScript.
So if you take 07-16-2022 & convert that to a julian number, 2459777, then simply decrement that number by 1, that will give you your consecutive days. Convert those numbers back to a date format & you're done

.
The hard part is in the details (& that is beyond me)

.
(Oops. I'd meant to "take" the starting date & increment... but if you take the ending date & decrement, that should work too.)