D
D
Dmitry2018-02-07 17:24:12
JavaScript
Dmitry, 2018-02-07 17:24:12

How to select all dates in the interval from date - to date in JavaScript?

How to select all dates in range from date - to date in JavaScript?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-02-07
@timon_it

Something like this:

let date = new Date('2018-02-01'),
    date2 = new Date('2018-02-08')

while (date < date2) {
  console.log(date)
  date.setDate( date.getDate() + 1 )
}
https://jsfiddle.net/spe8esgu/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question