itérator

Ne marche pas si appellé deux fois

const dateRange = {
  from: new Date(2018, 0, 23),
  to: new Date(2018, 3, 28),
  [Symbol.iterator]() {
    this.current = this.from

    return this
  },
  next() {
    if (this.current <= this.to) {
      this.current.setDate(this.current.getDate() + 1)

      return {
        done: false,
        value: new Date(this.current)
      }
    }

    return {
      done: true
    }
  }
}

const dateList = Array.from(dateRange);

dateList.forEach(date => {
    console.log(date.toString())
})