I need a counter that counts values: Days, e.g. 1, when ordering by 10:30 am, the change should be for 2 days after that time. Of course, the counter must also ignore the weekends.
So, buy on Friday at 14/10/2022 10:00, the date of dispatch should be on 17/10/2022. However, when ordering 14/10/2022 12:00, the shipping date should be on 18/10/2022.
it would be good to count down the time for submission to 10:30
function setShipDate () {
    // element to write date to  
    var shipdate = document.getElementById("date");
    // Set start date to today - end date in 2 days
    var startDate = new Date();
    var endDate = "", noOfDaysToAdd = 1, count = 0;
    // Map numeric month to name  
    var month = new Array();
      month[0] = "01";
      month[1] = "02";
      month[2] = "03";
      month[3] = "04";
      month[4] = "05";
      month[5] = "06";
      month[6] = "07";
      month[7] = "08";
      month[8] = "09";
      month[9] = "10";
      month[10] = "11";
      month[11] = "12";
    while(count < noOfDaysToAdd){
        // add a day to the end date each loop
        endDate = new Date(startDate.setDate(startDate.getDate() + 1));
        // only count when not a weekend
        if(endDate.getDay() != 0 && endDate.getDay() != 6){
           count++;
        }
    }
    // update shipdate HTML
    shipdate.innerHTML= endDate.getDate()  + '.' + month[endDate.getMonth()] + '.'  + endDate.getFullYear();
}
setShipDate();
Scheduled shipment: <span id = "date">
Surely it is possible to simplify this code + add this extra function mentioned above.
<today date> // today's date
<text id = "time"> // how much time I have left for the order with shipment:
<text id = "date"> // the end date according to the schedule until 10:30
 
     
    