Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Display next 5 days excluding Sundays in javascript

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #180423
    ani7ruddha
    Participant

    Display next 5 days excluding Sundays in javascript

    function setDateTime(){
    var timesOffice = (officeTimes[officeID]+"").split(",");
    //alert(officeTimes[officeID]+":12:"+timesOffice[0]);
    var dt= new Date(correctDate);
    var dateOptions = "";
    var firstdateString = "";
    var totalDays = 5;
    for (i=0;i<totalDays;i++){
    
        var sateString = dt.getFullYear() + " " + monthNames[dt.getMonth()] + " " + (dt.getDate());
        //console.log("i:"+i+"s:"+sateString);
        dateFlag = 0;
        var j = 0;
        for (j=0;j<timesOffice.length;j++) {
    
            if (checkValidDateTime(sateString,timesOffice[j])) {
                dateFlag=1;
                break;
            }
        }
        dt.setDate(dt.getDate()+1);
        if (dateFlag==0) {
            totalDays++;
            continue;
        }
        if (firstdateString=="") firstdateString=sateString;
        dateOptions = dateOptions+'<option value="'+sateString+'">'+sateString+'</option>';
    
    }
    $(".date").html(dateOptions);
    }

    I want to exclude Sundays from this list

    #180429
    ani7ruddha
    Participant

    Hows it excluding Sundays am not sure?

    #180499
    ani7ruddha
    Participant

    I am a noob at .js I am not able to figure out where shall that go ?

    #180504
    ani7ruddha
    Participant

    This is the site

    setDateTime is fetching date and time..

    officeTimes[officeID] are various office timings for different offices

    correctDate fetches correct date from server

    #180510
    ani7ruddha
    Participant

    checkValidDateTime is their so that to check if the time and date for placing order on site is valid or not if its not order cant be placed.

    I just want to exclude Sundays

    #180542
    ani7ruddha
    Participant

    And what if I want to display a popup if selected date is TOMORROW

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.