diff options
Diffstat (limited to 'bin/wiki/ImportarDesdeURL/node_modules/isostring/index.js')
-rw-r--r-- | bin/wiki/ImportarDesdeURL/node_modules/isostring/index.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/wiki/ImportarDesdeURL/node_modules/isostring/index.js b/bin/wiki/ImportarDesdeURL/node_modules/isostring/index.js new file mode 100644 index 00000000..847c65d9 --- /dev/null +++ b/bin/wiki/ImportarDesdeURL/node_modules/isostring/index.js @@ -0,0 +1,22 @@ + +module.exports = isDate; + + +/** + * Matching format per: http://www.w3.org/TR/NOTE-datetime + */ + +var isoformat = '^\\d{4}-\\d{2}-\\d{2}' + // Match YYYY-MM-DD + '((T\\d{2}:\\d{2}(:\\d{2})?)' + // Match THH:mm:ss + '(\\.\\d{1,6})?' + // Match .sssss + '(Z|(\\+|-)\\d{2}:\\d{2})?)?$'; // Time zone (Z or +hh:mm) + + +var matcher = new RegExp(isoformat); + + +function isDate (val) { + return typeof val === 'string' && + matcher.test(val) && + !isNaN(Date.parse(val)); +}
\ No newline at end of file |