Return to Snippet

Revision: 588
at March 28, 2007 01:14 by sendoa


Updated Code
/**--------------------------
//* Validate Date Field script- By JavaScriptKit.com
//* For this script and 100s more, visit http://www.javascriptkit.com
//* This notice must stay intact for usage
---------------------------**/

/*
 * Retocado por Sendoa Portuondo para un funcionamiento más personalizado
 */
function checkdate(dia, mes, anio){
    var validformat = /^\d{2}\/\d{2}\/\d{4}$/ //Basic check for format validity
    var returnval = false;
    
    if(!validformat.test(input.value)){
        return false;
    }else{ //Detailed check for valid date ranges
        var monthfield = mes;
        var dayfield = dia;
        var yearfield = anio;
        var dayobj = new Date(yearfield, monthfield-1, dayfield);
        if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield)){
            return false;
        }else{
            return true;
        }
    }
    
    return true;
}

Revision: 587
at July 20, 2006 07:49 by sendoa


Initial Code
/**--------------------------
//* Validate Date Field script- By JavaScriptKit.com
//* For this script and 100s more, visit http://www.javascriptkit.com
//* This notice must stay intact for usage
---------------------------**/

/*
 * Retocado por Sendoa B. Portuondo para un funcionamiento más personalizado
 */
function checkdate(dia, mes, anio){
    var validformat = /^\d{2}\/\d{2}\/\d{4}$/ //Basic check for format validity
    var returnval = false;
    
    if(!validformat.test(input.value)){
        return false;
    }else{ //Detailed check for valid date ranges
        var monthfield = mes;
        var dayfield = dia;
        var yearfield = anio;
        var dayobj = new Date(yearfield, monthfield-1, dayfield);
        if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield)){
            return false;
        }else{
            return true;
        }
    }
    
    return true;
}

Initial URL

                                

Initial Description

                                

Initial Title
Comprobar fecha

Initial Tags

                                

Initial Language
JavaScript