isISO8601.js 827 B

12345678910111213141516171819202122
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.iso8601 = undefined;
  6. exports.default = function (str) {
  7. (0, _assertString2.default)(str);
  8. return iso8601.test(str);
  9. };
  10. var _assertString = require('./util/assertString');
  11. var _assertString2 = _interopRequireDefault(_assertString);
  12. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13. /* eslint-disable max-len */
  14. // from http://goo.gl/0ejHHW
  15. var iso8601 = exports.iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
  16. /* eslint-enable max-len */