0

never programmed in JavaScript before, so I ask your assistance to display the expiry date when user chooses start and end date from the calendar. After selecting the end date from the calendar, the expiry date should display added two months to the end date. For example: The user chooses Oct. 9, 2012 as Start Date; Oct. 16, 2012 as the end date; Dec. 16, 2012 should be the expiry date. How can I achieve this in JavaScript?

Please check this code, cause I don't know how to edit this one.

/**
* Click "Cal" on expiry date
*/
function getExpiryDate() {
if(!document.getElementById('enddate').value.length) {
alert("End date must be set first.");
}
else {
prevExpiryDate = document.getElementById('expirydate').value;
displayCalendar(document.forms[0].expirydate,'yyyy/mm/dd',
    document.getElementById('expirydatebutton'));
 }
}
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Taywin
0

The requirement needs to be clarified first. What is the expiry date if the end date is July 31? Would it be September 30? Or would it be October 1?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.