Validation for Date using Jquery

2 posts, 0 answers
  1. Radhika
    Radhika avatar
    8 posts
    Member since:
    Nov 2012

    Posted 29 Jul 2013 Link to this post


      I am using calendar control Type="date".How can i give validation to check whether the given date is in correct format or not.

    <div style="margin-top:2px; width:98%;">
          <div class="black-lbl-text-mid"  style="width:55%; padding-left:0px; float:left; text-align:left;">Start Date </div>
    <div style="float:left; width:98%;" >
          <input id="txtLabourStartDate" type="date"  name="txtLabourStartDate" class="textbox-3" style="width:50%;  float:left; text-align:left;"/>
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 31 Jul 2013 Link to this post


     You can use the kendo.parseDate method to do this. If it returns null then the date is not valid. Here is a quick demo:

    var value = $("#txtLabourStartDate").val();

    var date = kendo.parseDate(value, "yyyy/MM/dd");

    if (date == null) {
       // invalid

    Atanas Korchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top