JS to determine whether the date of birth is correct

Source: Internet
Author: User
var r =/^ (?:(?! 0000) [0-9]{4}-(?:(?: 0 [1-9]|1[0-2])-(?: 0 [1-9]|1[0-9]|2[0-8]) | (?: 0 [13-9]|1[0-2])-(?: 29|30) | (?: 0 [13578]|1[02])-31) | (?: [0-9]{2} (?: 0 [48]| [2468] [048]| [13579] [26]) | (?: 0 [48]| [2468] [048]| [13579] [26]) (xx) -02-29)$/            ; if (!r.test ($ ("#birthday_id"). Val ())) {                $u. Dialog_util.showtypedialog ("Common", "Please enter the correct birthday, as in 1993-07-09" );                $ ("#birthday_id"). Val ("");            }

1. Taking into account that the year of birth is 19xx years

2. Taking into account the month January to February

3. Considering the leap year February 29 days

4. Considering the common year February 28 days

5. All years including common year 1, 3, 5, 7, 8, 10, December inclusive of 31st

Content reference: http://www.jb51.net/article/50905.htm

JS to determine whether the date of birth is correct

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.