shortysbest Posted October 3, 2010 Share Posted October 3, 2010 I want to only allow birthdays to be entered like: 1/9/1992 or 11/19/1992 no other characters. and i want to only allow the first part to be a number be between 1 and 12, and then the second only between 1 and 31. could anyone help with any part of this? the first part is most important, but second part is nearly as important. Quote Link to comment Share on other sites More sharing options...
.josh Posted October 3, 2010 Share Posted October 3, 2010 var someDate = "10/03/2010"; if (someDate.match(/^(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])\/(19|20)[0-9]{2}$/)) { // valid } else { // invalid } Quote Link to comment Share on other sites More sharing options...
shortysbest Posted October 3, 2010 Author Share Posted October 3, 2010 PERFECT. Thanks a lot. A lot more simple than I thought. >.< Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.