Skip to content

Instantly share code, notes, and snippets.

Created September 3, 2013 16:25
Show Gist options
  • Save anonymous/6426151 to your computer and use it in GitHub Desktop.
Save anonymous/6426151 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://extjs.cachefly.net/ext-4.1.1-gpl/ext-all-debug.js"></script>
<link rel="stylesheet" href="http://extjs.cachefly.net/ext-4.1.1-gpl/resources/css/ext-all.css">
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
Ext.onReady(function(){
var fe = '04/18/2012';
var dt = Ext.Date.add(new Date('8/30/2006'), Ext.Date.DAY, 1);
//console.log(Ext.Date.format(dt,'d/m/Y'));
var str = fe;
var pad = str.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
datarex = /^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/ ;
var reg = new RegExp(/^(((0[13578]|1[02])\/(0[1-9]|[12]\d|3[01])\/((19|[2-9]\d)\d{2}))|((0[13456789]|1[012])\/(0[1-9]|[12]\d|30)\/((19|[2-9]\d)\d{2}))|(02\/(0[1-9]|1\d|2[0-8])\/((19|[2-9]\d)\d{2}))|(02\/29\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/g);
console.log(reg.test(str));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment