.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / node_modules / ajv / dist / runtime / timestamp.js
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 const DATE_TIME = /^(\d\d\d\d)-(\d\d)-(\d\d)(?:t|\s)(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i;
4 const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
5 function validTimestamp(str) {
6     // http://tools.ietf.org/html/rfc3339#section-5.6
7     const matches = DATE_TIME.exec(str);
8     if (!matches)
9         return false;
10     const y = +matches[1];
11     const m = +matches[2];
12     const d = +matches[3];
13     const hr = +matches[4];
14     const min = +matches[5];
15     const sec = +matches[6];
16     const tzH = +(matches[7] || 0);
17     const tzM = +(matches[8] || 0);
18     return (m >= 1 &&
19         m <= 12 &&
20         d >= 1 &&
21         (d <= DAYS[m] ||
22             // leap year: https://tools.ietf.org/html/rfc3339#appendix-C
23             (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0))) &&
24         ((hr <= 23 && min <= 59 && sec <= 59) ||
25             // leap second
26             (hr - tzH === 23 && min - tzM === 59 && sec === 60)));
27 }
28 exports.default = validTimestamp;
29 validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default';
30 //# sourceMappingURL=timestamp.js.map