• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 753
  • Last Modified:

How to validate a Date field with JQuery

Hi Experts,
I am a Jquery newbie.  I am making a webpage where I am using date picker in Jquery to supply the calender for two input fields. I want to validate the date after the selection is done or the user types a date on his own.
Also the first input field is checkin and the second one is check out. So I need also make sure that they can't select the same date in the check out field as they do in check in date
can you please  help me figure this out?
Thanks in advance guys
0
guyneo
Asked:
guyneo
  • 4
  • 3
2 Solutions
 
Gurvinder Pal SinghCommented:
you need to parse the date into the date object and then check for equality (assuming that both dates are in different format, else just a if condition will suffice)
use Datejs for doing parsing
http://www.datejs.com/
0
 
sam2912Commented:
Please post a link to your page.
0
 
guyneoAuthor Commented:
@gurvinder I will give it a try. I am wondering if Jquery validate plugin will be able to do this with ease?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
sam2912Commented:
I don't mean to be rude, but the more information you provide to us regarding your problem the faster you will receive a solution that you can implement quickly, rather than having everyone to guess (or even skip over) your question. If you had provided your page code, somebody might have already coded the solution for you.

Regards
0
 
guyneoAuthor Commented:
No offense taken Sam. What you say is right.
However the developement machine and hence the webpage is not accesible from outside. So I can't post the link. I can post the relevant part of the form if that would help to get an idea of what I need.  It is a basic book/document library application   The webpage I am trying to validate is pretty simple. Regular Date fields: One field for checkOut and One for CheckIn.
0
 
sam2912Commented:
Okay. What is the format of the date you are trying to validate? DD/MM/YY?
0
 
guyneoAuthor Commented:
Yes. or   DD/MM/YYYY
0
 
sam2912Commented:
You could do something like this
foo50---Validate-DatePicker.html
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now