js validate string as year code example
Example: check if string is datestring javascript
moment("2015-06-22T13:17:21+0000", moment.ISO_8601, true).isValid(); // true
moment("2015-06-22T13:17:21+0000", moment.ISO_8601, true).isValid(); // true