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

Freegle / iznik-nuxt3 / 933b5598-9b95-4d39-8a74-8e8369383e3c

16 Sep 2025 09:24AM UTC coverage: 45.764% (+0.07%) from 45.697%
933b5598-9b95-4d39-8a74-8e8369383e3c

push

circleci

edwh
Suppress confusing error during login

1780 of 4628 branches covered (38.46%)

Branch coverage included in aggregate %.

4032 of 8072 relevant lines covered (49.95%)

103.53 hits per line

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

25.32
/composables/useTimeFormat.js
1
// Vue v3 doesn't support filters, so we have a composable which defines methods to achieve the same goal.
2
import dayjs from 'dayjs'
3
import isToday from 'dayjs/plugin/isToday'
4
import advancedFormat from 'dayjs/plugin/advancedFormat'
5
import relativeTime from 'dayjs/plugin/relativeTime'
6
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter'
7
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
8

9
dayjs.extend(advancedFormat)
36✔
10
dayjs.extend(relativeTime)
36✔
11
dayjs.extend(isToday)
36✔
12
dayjs.extend(isSameOrAfter)
36✔
13
dayjs.extend(isSameOrBefore)
36✔
14

15
export function earliestDate(dates, ofall) {
×
16
  // Find the earliest date which is in the future.
17
  const now = Date.now()
×
18
  let earliest = null
×
19
  let earliestDate = null
×
20

21
  for (let i = 0; i < dates?.length; i++) {
×
22
    const atime = new Date(dates[i].start).getTime()
×
23
    if ((ofall || atime >= now) && (!earliest || atime < earliest)) {
×
24
      earliest = atime
×
25
      earliestDate = dates[i]
×
26
    }
27
  }
28

29
  return earliestDate
×
30
}
31

32
export function addStrings(item, times) {
×
33
  // Add human readable versions of each date range.
34
  if (item) {
×
35
    for (let i = 0; i < item?.dates?.length; i++) {
×
36
      const date = item.dates[i]
×
37
      const startm = dayjs(date.start)
×
38
      let endm = dayjs(date.end)
×
39

40
      if (times) {
×
41
        endm = endm.isSame(startm, 'day')
×
42
          ? endm.format('HH:mm')
43
          : endm.format('ddd, Do MMM HH:mm')
44

45
        item.dates[i].string = {
×
46
          start: startm.format('ddd, Do MMM HH:mm'),
47
          end: endm,
48
          past: Date.now() > new Date(date.start),
49
        }
50
      } else {
51
        endm = endm.format('ddd, Do MMM')
×
52

53
        item.dates[i].string = {
×
54
          start: startm.format('ddd, Do MMM'),
55
          end: endm,
56
          past: Date.now() > new Date(date.start),
57
        }
58
      }
59
    }
60
  }
61

62
  return item
×
63
}
64

65
export function timeago(val, past) {
229✔
66
  let f = null
229✔
67

68
  // dayjs pluralises wrongly in some cases - we've seen 1 hours ago.
69
  const dePlural = /^1 (.*)s/
229✔
70

71
  const v = dayjs(val)
229✔
72
  f = v.fromNow()
229✔
73
  f = f.replace(dePlural, '1 $1')
229✔
74

75
  if (past && f === 'in a few seconds') {
229!
76
    f = 'just now'
×
77
  }
78

79
  return f
229✔
80
}
81

82
export function timeadapt(val) {
×
83
  const t = dayjs(val)
×
84

85
  if (t.isToday()) {
×
86
    // For today, just show the time.
87
    return t.format('HH:mm')
×
88
  } else {
89
    return t.format('DD MMM YYYY HH:mm')
×
90
  }
91
}
92

93
export function datelocale(val) {
×
94
  return dayjs(val).toLocaleString()
×
95
}
96

97
export function dateonly(val) {
7✔
98
  return dayjs(val).format('Do MMMM, YYYY')
7✔
99
}
100

101
export function datetime(val) {
×
102
  return dayjs(val).format('Do MMMM, YYYY HH:mm:ss')
×
103
}
104

105
export function datetimeshort(val) {
4✔
106
  return dayjs(val).format('Do MMM, YYYY HH:mm')
4✔
107
}
108

109
export function dateshort(val) {
×
110
  return dayjs(val).format('MMM DD, YYYY')
×
111
}
112

113
export function dateonlyNoYear(val) {
×
114
  return dayjs(val).format('Do MMMM')
×
115
}
116

117
export function weekdayshort(val) {
×
118
  return dayjs(val).format('dddd Do HH:mm a')
×
119
}
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