• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

panates / postgresql-client / 153d71be-3f57-44f4-80b5-4bcc14c4ad78

01 Jul 2024 08:06AM UTC coverage: 85.684%. Remained the same
153d71be-3f57-44f4-80b5-4bcc14c4ad78

push

circleci

erayhanoglu
Update dependencies

698 of 985 branches covered (70.86%)

Branch coverage included in aggregate %.

2522 of 2773 relevant lines covered (90.95%)

816.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.38
/src/util/parse-time.ts
1
import { fastParseInt } from './fast-parseint.js';
30✔
2

3
// eslint-disable-next-line
4
// noinspection RegExpUnnecessaryNonCapturingGroup
5
export const STRICT_TIME_PATTERN =
30✔
6
  /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?$/;
7
// noinspection RegExpUnnecessaryNonCapturingGroup
8
export const TIME_PATTERN =
30✔
9
  /^([01][0-9]|2[0-3]):?([0-5][0-9]):?([0-5][0-9])?(?:\.(\d+))?(?:(Z)|(?:([+-])([01]?[0-9]|2[0-3]):?([0-5][0-9])?))?$/;
10

11
export function parseTime(str: string, parseTimeZone?: boolean, utc?: boolean): Date {
30✔
12
  const m = str.match(TIME_PATTERN);
36✔
13
  if (!m) return new Date('invalid');
36!
14

15
  const args: [number, number, number, number, number, number, number] = [1970, 0, 1, 0, 0, 0, 0];
36✔
16
  for (let i = 1; i < 4; i++) {
36✔
17
    const s = m[i];
108✔
18
    args[i + 2] = fastParseInt(s) || 0;
108✔
19
  }
20

21
  if (parseTimeZone && m[6]) {
36!
22
    const r = m[9] === '-' ? -1 : 1;
×
23
    args[3] -= (fastParseInt(m[7]) || 0) * r;
×
24
    args[4] -= (fastParseInt(m[8]) || 0) * r;
×
25
    return new Date(Date.UTC(...args));
×
26
  }
27
  if (m[5] || utc) return new Date(Date.UTC(...args));
36✔
28
  return new Date(...args);
24✔
29
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc