Frankie M Posted August 31, 2019 Share Posted August 31, 2019 With our limited knowledge we were able to exclude certain dates in a date delivery module based on weekday and time. See code below. But now we want to exclude all Wednesdays and Saturdays in the next year if you select carrier 99. Can someone please help us how to write that code? Current code: var selected_carrier = parseInt($('.delivery_option_radio:checked').val()); var weekdag = new Date().getDay(); var uur = new Date().getHours(); var vandaag = new Date(); var morgen = new Date(); morgen.setDate(vandaag.getDate()+1); var exclmaand = morgen.getMonth()+1; var excldag = morgen.getDate(); var excldatum = exclmaand + "-" + excldag; // carrier is postnl if (selected_carrier == 99) { // weekdag 0 is zondag t/m 6 is zaterdag if (weekdag > -1 && weekdag < 5) { // na 23 uur if (uur >= 23) { disabledDays.push(excldatum); } } } if (selected_carrier == 99) { // weekdag 5 is vrijdag if (weekdag == 5) { // na 10 uur if (uur >= 10) { disabledDays.push(excldatum); } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now