i have had the same issue and i have managed to get around this by using some javascript:
<script type="text/javascript">
var monthNames = ['01', '02', '03', '04', '05', '06','07', '08', '09', '10', '11', '12'];
function doDate(el, erID) {
var s = el.value;
var d, m, y;
var len = s.length;
if (10 == len) {
d = s.substring(0, 2);
m = s.substring(3, 5);
y = s.substring(6, 10);
} else if (8 == len) {
d = s.substring(0, 2);
m = s.substring(2, 4);
y = s.substring(4, 8);
} else if (6 == len) {
d = s.substring(0, 2);
m = s.substring(2, 4);
y = '20' + s.substring(4, 6); // edit the 20 to 19 for e.g. 1990
}
if (checkDate(y, m, d)) {
el.value = d + '/' + monthNames[m - 1] + '/' + y;
}
if (document.getElementById) {
}
}
function checkDate(y, m, d) {
m = '' + (m - 1);
var checkDate = new Date(y, m, d);
return (checkDate.getMonth() == m
&& checkDate.getFullYear() == y);
}
</script>
raghav_khung...
All-Star
32835 Points
5563 Posts
MVP
Re: How check Date of Birth in Jquery Validation
Nov 14, 2010 07:28 AM|LINK
Look http://jsbin.com/ebevo it is automatically adding "/"
MattStan
Member
2 Points
1 Post
Re: How check Date of Birth in Jquery Validation
Jul 13, 2011 09:28 AM|LINK
i have had the same issue and i have managed to get around this by using some javascript:
<script type="text/javascript"> var monthNames = ['01', '02', '03', '04', '05', '06','07', '08', '09', '10', '11', '12']; function doDate(el, erID) { var s = el.value; var d, m, y; var len = s.length; if (10 == len) { d = s.substring(0, 2); m = s.substring(3, 5); y = s.substring(6, 10); } else if (8 == len) { d = s.substring(0, 2); m = s.substring(2, 4); y = s.substring(4, 8); } else if (6 == len) { d = s.substring(0, 2); m = s.substring(2, 4); y = '20' + s.substring(4, 6); // edit the 20 to 19 for e.g. 1990 } if (checkDate(y, m, d)) { el.value = d + '/' + monthNames[m - 1] + '/' + y; } if (document.getElementById) { } } function checkDate(y, m, d) { m = '' + (m - 1); var checkDate = new Date(y, m, d); return (checkDate.getMonth() == m && checkDate.getFullYear() == y); } </script>