martedì 19 febbraio 2013

Verify Future Date with Javascript

The following Javascript function shows a way to verify if a date is in the future:

function isFutureDate(obj)
{
    var dteDate;
    var now = new Date().format("yyyyMMdd");
    obj1 = obj.split("/");
    var day = parseInt(obj1[0], 10);
    var month = parseInt(obj1[1], 10);
    var year = parseInt(obj1[2], 10);

    var born = obj1[2] + obj1[1] + obj1[0];

    if (parseInt(born) > parseInt(now))
        return true;
    else
        return false;
}


My Two Cents ...

Nessun commento:

Posta un commento