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

CBIIT / crdc-datahub-ui / 18789341118

24 Oct 2025 06:57PM UTC coverage: 78.178% (+15.5%) from 62.703%
18789341118

push

github

web-flow
Merge pull request #888 from CBIIT/3.4.0

3.4.0 Release

4977 of 5488 branches covered (90.69%)

Branch coverage included in aggregate %.

8210 of 9264 new or added lines in 257 files covered. (88.62%)

6307 existing lines in 120 files now uncovered.

30203 of 39512 relevant lines covered (76.44%)

213.36 hits per line

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

90.63
/src/utils/dateUtils.ts
1
import dayjs from "dayjs";
1✔
2
import duration from "dayjs/plugin/duration";
1✔
3
import timezone from "dayjs/plugin/timezone";
1✔
4
import utc from "dayjs/plugin/utc";
1✔
5

6
dayjs.extend(utc);
1✔
7
dayjs.extend(timezone);
1✔
8
dayjs.extend(duration);
1✔
9

10
/**
11
 * Format a date string to a specified pattern
12
 *
13
 * @param date input date string
14
 * @param pattern output date pattern
15
 * @param fallbackValue value to return if date is invalid or fails to format
16
 * @param offsetTimezone whether to offset UTC to the user's timezone
17
 * @returns formatted date or fallbackValue if invalid
18
 */
19
export const FormatDate = (
1✔
20
  date: string,
1,588✔
21
  pattern = "M/D/YYYY",
1,588✔
22
  fallbackValue = null,
1,588✔
23
  offsetTimezone = true
1,588✔
24
): string => {
1,588✔
25
  const dateObj = offsetTimezone ? dayjs(date) : dayjs.utc(date);
1,588✔
26

27
  if (!dateObj?.isValid()) {
1,588✔
28
    return fallbackValue;
1,178✔
29
  }
1,178✔
30

31
  try {
410✔
32
    return dateObj?.format(pattern);
1,588✔
33
  } catch (e) {
1,588!
34
    return fallbackValue;
×
UNCOV
35
  }
×
36
};
1,588✔
37

38
/**
39
 * Parses a number of seconds into a string formatted as "mm:ss".
40
 *
41
 * @note Supports up to 59 minutes and 59 seconds.
42
 * @param seconds The number of seconds to convert.
43
 * @returns A string formatted as "mm:ss".
44
 */
45
export const secondsToMinuteString = (seconds: number) =>
1✔
46
  dayjs.duration(seconds, "seconds").format("mm:ss");
14✔
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