Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8896503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:04:53+00:00 2026-06-15T00:04:53+00:00

I have a form with a jQuery UI Datepicker, which then gets validated using

  • 0

I have a form with a jQuery UI Datepicker, which then gets validated using the jQuery Validation plugin.

Datepickers are created using:

$("#dob").datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: "dd/mm/yy",
        onSelect: function (){
            this.focus();   
        },
    });

However the validation plugin seems to validate in the US format when I require it to validate using dd/mm/yyyy. This means that any date past the 12th of any month is deemed invalid.

I have looked around and I found a method to add a different way to validate the date using a regular expression:

$.validator.addMethod(
    "australianDate",
    function(value, element) {
        return value.match(/^(0?[1-9]|[12][0-9]|3[01])\/(0?[1-9]|1[012])\/((19|20)\\d\\d)$/);
    },
    "Please enter a date in the format dd/mm/yyyy."
);

which is then added to the rules:

        dob:{
             required:true,
             australianDate: true
        },

but this still seems to fail for any input.

the regular expression I am using is one I have used in the past with php and is a bit more accurate then the generic (any2numbers/any2numbers/any4numbers) expression, and I would like to be able to use it in the javascript aswell.

Do javascript regular expressions need to be in a different format to php? is that where I am going wrong..

Any help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:04:56+00:00Added an answer on June 15, 2026 at 12:04 am

    Just a comment:

    A better date validation function is:

    // Expects date string in format dd/mm/yyyy
    function isValidDate(s) {
      if (s === null || s.length !== 10) {
        return false;
      }
      s = s.split('/');
      var d = new Date(s[2], --s[1], s[0]);
      return d.getFullYear() == s[2] && d.getDate() == s[0];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a form which uses the JQuery Validation Plugin and would like to
I have a form which is built dynamically using this jQuery plugin http://code.google.com/p/jquery-dynamic-form/ When
I have a form which includes a JQUERY datepicker attatched to an <input> on
I'm using the datepicker form jQuery-ui-1.8.16. I have the following code: Site.Calendar = function()
I have used Jquery UI DatePicker for the option in my form to select
I have a form what jQuery sents for me using Ajax to php. For
I have a form on a webpage that I submit using the jquery form
I have jQuery Datepicker inside my form. My problem is after I have clicked
I've created a page which combines an inline jQuery UI datepicker . I wan't
I have customized jqGrid's edit form to have some fields that use jQuery's DatePicker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.