Date validation javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • parshupooja
    New Member
    • Jun 2007
    • 159

    #1

    Date validation javascript

    I want to validate a date via javascript. Date should not be in future and date should not me more than seven days old.

    Any idea? help
    Last edited by parshupooja; Jan 30 '08, 11:08 PM. Reason: err
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by parshupooja
    I want to validate a date via javascript. Date should not be in future and date should not me more than seven days old.

    Any idea? help
    Have a read at this thread which has a link (the one posted by acoder) to all the date functions.

    Comment

    • parshupooja
      New Member
      • Jun 2007
      • 159

      #3
      thanks for replying but thread does not mention about geting future date and I am looking for that.

      Originally posted by r035198x
      Have a read at this thread which has a link (the one posted by acoder) to all the date functions.

      Comment

      • mrhoo
        Contributor
        • Jun 2006
        • 428

        #4
        If the only possible dates are the previous seven days, just offer 7 choices in a radio or select menu.

        Start with today's date, which you get from new Date(), and use the .setDate() method on that date to get the previous 6 days.

        Validating user input dates is hard- avoid it by giving the user only valid choices.

        Comment

        Working...