Comaprission of dates for a year in JavaScript

This article and code snippet shows how to use JavaScript to validate dates in a method for a year.

I will call a method closed, so that it will be easy for me to recognize it, in that I will use the tab name because as I have declared with in the tab name and a English date, I see another method from where I am calling it. I am displaying like this, if financial year has closed on March 31st exactly than the next date will automatically reflect from first of the April this is what is happening in this method

Check CloseDate()
    var OpDtd = new Date(Tab.findControl("OpDt_txtDateInEnglish").
    var ClDtd = new Date(Tab.findControl("ClDt_txtDateInEnglish").
    var tempClose = newDate(ClDtd.getFullYear(),ClDtd.getMonth(),
    var tempOpen = new Date(OpDtd.getFullYear(),OpDtd.getMonth(),
    var one_day=1000*60*60*24;
    var ddiff = Math.ceil
    return 0;
    return 1;
        oEvent.needPostBack = false;
        AlertMessageBox("Please enter valid Period");  
        return false;

I need to validate this method. I will check this using the validating method.