I’m adding days to a specific date:
myDate.setDate(myDate.getDate()+plusdays
Where plusdays is my variable, everything works fine.
Now I would like to calculate the result in a way that permits to skip a given period of time (eventually specified by the user) (e.g. from 1 of April until 15 of April), which is not necessarly an holiday.
I have reviewed the similar questions but either I don’t understand them, or I guess they don’t really solve my problem.
Any ideas?
EDIT: my main problem is that the days should be skipped only when relevant to the calculation. In other words, I need a solution that if I ad 30 days to 28 march, it adds 30 days without counting between 1 aprile – 15 april, but if I add 1 day to 28 march, then the result is simply 29 march.
In the logic of your current code it should be something like
To calculate
skipdaysuseupdate
After your comment you can use
This method will calculate the number of intersected days between to date ranges..
Use as
So in your example
Demo at http://jsfiddle.net/gaby/mACmW/