23 lines
836 B
JavaScript
23 lines
836 B
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = isISO8601;
|
|
|
|
var _assertString = require('./util/assertString');
|
|
|
|
var _assertString2 = _interopRequireDefault(_assertString);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
/* eslint-disable max-len */
|
|
// from http://goo.gl/0ejHHW
|
|
var 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)?)?)?)?$/;
|
|
/* eslint-enable max-len */
|
|
|
|
function isISO8601(str) {
|
|
(0, _assertString2.default)(str);
|
|
return iso8601.test(str);
|
|
}
|
|
module.exports = exports['default']; |