I figured it out I am calling the function when datepicker is initializing at that time the issuedate is empty so i placed the function call in the onclose event of the issudate datepicker now everything works fine thank you all for answering.