- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
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
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
Hows it excluding Sundays am not sure?
I am a noob at .js I am not able to figure out where shall that go ?
setDateTime is fetching date and time..
officeTimes[officeID] are various office timings for different offices
correctDate fetches correct date from server
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
And what if I want to display a popup if selected date is TOMORROW