Skip to content

Instantly share code, notes, and snippets.

@webpapaya
Created October 3, 2016 21:22
Show Gist options
  • Save webpapaya/3142fc3b7150a776d68286b64d2678ae to your computer and use it in GitHub Desktop.
Save webpapaya/3142fc3b7150a776d68286b64d2678ae to your computer and use it in GitHub Desktop.
Validate iso8601 date
/^[+-]?\d+\b$|^[+-]?\d+\b-[+-]?\d{2}$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}:[+-]?\d{2}$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}:[+-]?\d{2}:[+-]?\d{2}(\.\d+)?$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}:[+-]?\d{2}[+-]\d{2}(:\d{2})?|Z$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}[+-]\d{2}(:\d{2})?|Z$|^[+-]?\d+\b-[+-]?\d{2}-[+-]?\d{2}[\sT][+-]?\d{2}:[+-]?\d{2}:[+-]?\d{2}(\.\d+)?[+-]\d{2}(:\d{2})?|Z/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment