Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get an day array when have a startDay and FinishDay js

 function getDates(beginDate: Date, endDate: Date) {
    var dateArray = new Array()
    var currentDate = beginDate
    while (currentDate <= endDate) {
      dateArray.push(currentDate)
      currentDate = addDays(1, currentDate)
    }
    return dateArray
  }

  function addDays(days: number, currentDate: Date) {
    var dat = new Date(currentDate)
    dat.setDate(dat.getDate() + days)
    return dat
  }
 
PREVIOUS NEXT
Tagged: #day #array #startDay #FinishDay #js
ADD COMMENT
Topic
Name
5+3 =