How to use the duration function from dayjs

Find comprehensive JavaScript dayjs.duration code examples handpicked from public code repositorys.

122
123
124
125
126
127
128
129
130
131
  await datasetUtils.updateStorage(db, dataset)
}

// manage history TTL
if (dataset.rest.historyTTL && dataset.rest.historyTTL.active && dataset.rest.historyTTL.delay && dataset.rest.historyTTL.delay.value) {
  const expireAfterSeconds = dayjs.duration(dataset.rest.historyTTL.delay.value, dataset.rest.historyTTL.delay.unit || 'days').asSeconds()
  await revisionsCollection.createIndex({ _updatedAt: 1 }, { expireAfterSeconds, name: 'history-ttl' })
} else {
  try {
    await revisionsCollection.dropIndex('history-ttl')
fork icon6
star icon26
watch icon4

+ 4 other calls in file

4
5
6
7
8
9
10
11
12
13
14
15
const { fallback, queryToBoolean } = require('@/utils/readable-social');


const titleRegex = /(.+)\s+is\s+([A-Z]+)\s+\((.+)\)/;


const formatTime = (s) => {
    const duration = dayjs.duration(s - 0, 'seconds');
    const days = duration.days();
    const hours = duration.hours();
    const minutes = duration.minutes();
    const seconds = duration.seconds();
fork icon0
star icon0
watch icon1

+ 4 other calls in file