SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    0 Post(s)
    0 Thread(s)

    validate two date coming in the format YYYY-MM-DD coming through PopUP-Calendar

    i m trying to validate two date coming in the format 'YYYY-MM-DD' coming through PopUP-Calendar in two textboxes(From date and To Date), If i select a date from "From date" Then in to date i must select date >= From date.

    Plz help me.

  2. #2
    SitePoint Addict sdleihssirhc's Avatar
    Join Date
    Feb 2009
    1 Post(s)
    0 Thread(s)
    There's a lot of handwaving that goes on here, but you should be able to simply create two Date objects and compare them:

    Code JavaScript:
    // these are just examples
    var from = '2012-02-01',
        to = '2012-02-03';
    from = new Date(from);
    to = new Date(to);
    alert(to >= from); // alerts "true"
    Last edited by sdleihssirhc; Feb 7, 2012 at 13:29. Reason: typo
    I'm the web overlord for Graphic Business Systems


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts