@minofrk/msf-io-ts
Version:
Type utilities with io-ts for MSF format.
31 lines • 1.11 kB
JavaScript
;
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
function isRFC3339(rfc3339) {
var $ = rfc3339.match(/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(?:[01][0-9]|2[0-3]):(?:[0-5][0-9]):(?:[0-5][0-9]|60)(?:\.[0-9]+)?(?:Z|(?:\+|-)(?:[01][0-9]|2[0-3]):[0-5][0-9])$/i);
if ($ === null) {
return false;
}
var _a = __read($.map(Number), 4), fullyear = _a[1], month = _a[2], mday = _a[3];
if (new Date(fullyear, month - 1, mday).getDate() !== mday) {
return false;
}
return true;
}
exports.default = isRFC3339;
//# sourceMappingURL=is-rfc3339.js.map