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

Freegle / iznik-nuxt3 / 01f30173-8c4e-42c1-b8b2-8e6685a74ca3

31 Jul 2025 07:52AM UTC coverage: 38.495% (-0.2%) from 38.679%
01f30173-8c4e-42c1-b8b2-8e6685a74ca3

push

circleci

chriscant
Another chat message fix. Bump to 3.2.2

1724 of 5816 branches covered (29.64%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

22 existing lines in 6 files now uncovered.

4290 of 9807 relevant lines covered (43.74%)

119.63 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)
82✔
10
dayjs.extend(relativeTime)
82✔
11
dayjs.extend(isToday)
82✔
12
dayjs.extend(isSameOrAfter)
82✔
13
dayjs.extend(isSameOrBefore)
82✔
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) {
263✔
66
  let f = null
263✔
67

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

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

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

79
  return f
263✔
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) {
17✔
98
  return dayjs(val).format('Do MMMM, YYYY')
17✔
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) {
12✔
106
  return dayjs(val).format('Do MMM, YYYY HH:mm')
12✔
107
}
108

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

UNCOV
113
export function dateonlyNoYear(val) {
×
UNCOV
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