Skip to content

Instantly share code, notes, and snippets.

@sambhav2612
Last active October 15, 2020 09:22
Show Gist options
  • Save sambhav2612/7349f373b034e4fb75c704577bf85c14 to your computer and use it in GitHub Desktop.
Save sambhav2612/7349f373b034e4fb75c704577bf85c14 to your computer and use it in GitHub Desktop.
regex to check for iso date strings under ''
console.log(new Date().toISOString().match(/('((?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(.[0-9]+)?(Z)')/g).length > 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment