Skip to content

Instantly share code, notes, and snippets.

View coding-chris-kao's full-sized avatar
🏠
Working from home

Chris Kao coding-chris-kao

🏠
Working from home
View GitHub Profile
@miguelmota
miguelmota / getDates.js
Last active February 7, 2024 23:43
Get dates in between two dates with JavaScript.
// Returns an array of dates between the two dates
function getDates (startDate, endDate) {
const dates = []
let currentDate = startDate
const addDays = function (days) {
const date = new Date(this.valueOf())
date.setDate(date.getDate() + days)
return date
}
while (currentDate <= endDate) {