Add days after date is selected excluding weekends and holidays

前端 未结 3 1940
半阙折子戏
半阙折子戏 2021-01-06 10:28

I have two text fields. In the first textfield I have added a calendar using jQueryUI Datepicker. When the user selects the date from the datepicker, it should automatically

3条回答
  •  梦谈多话
    2021-01-06 10:56

    var numAdd = 30
    var dataAvui = new Date()
    for (var i=0;i<=numAdd;i++)
    { 
        var dataTemp = dataAvui
        console.dir(dataTemp.toString())
        dataTemp.setDate(dataTemp.getDate() + 1)
        if(dataTemp.getDay() == 6){
            dataTemp.setDate(dataTemp.getDate() + 2)
        }else if(dataTemp.getDay() == 0){
            dataTemp.setDate(dataTemp.getDate() + 1)
        }
    
        dataAvui = dataTemp
    }
    

提交回复
热议问题