What are your goals here? To make it easy for the user? To make it easy for the shipping department?
What is the allowable range? For example, could a month of October or less still be valid today? How far in the future should be go?
Are dropdowns the best option? Could you pop up a calendar with the innapropriate dates grayed?
As an aside,
if ( condition ) {
return true;
} else {
return false;
}
// above is the long way to say this:
return condition;
You'll have to look at 'if (cond == false)' ... as a variant. In general, changing the condition around to check for 'true' is a good idea. (Replace '(x < 2)' with '(x >= 2)', for example.)
MartinRinehart
Junior Poster in Training
97 posts since Jun 2010
Reputation Points: 11
Solved Threads: 10
Skill Endorsements: 0
That being the case, fall back on your original attempt. Get the date through dropdowns and validate the result. Was your original code not working? Why?
MartinRinehart
Junior Poster in Training
97 posts since Jun 2010
Reputation Points: 11
Solved Threads: 10
Skill Endorsements: 0
No need for 'today'. 'var d = new Date()' is today's date and time.
Without all the details, it looks like the '+1' month is an issue. 'today' is today's date, in December. Try living with months 0 thru 11.
MartinRinehart
Junior Poster in Training
97 posts since Jun 2010
Reputation Points: 11
Solved Threads: 10
Skill Endorsements: 0