Skip to content

Instantly share code, notes, and snippets.

@shenqihui
Created May 20, 2014 10:08
Show Gist options
  • Save shenqihui/8cb93a0b93cc028fc833 to your computer and use it in GitHub Desktop.
Save shenqihui/8cb93a0b93cc028fc833 to your computer and use it in GitHub Desktop.
Valid or Invalid Date
var a = '20140531';
var str = a.substring(0,4)+'-'+a.substring(4,6)+'-'+a.substring(6);
var date = new Date(str);
date.getFullYear() === date.getFullYear();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment