Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 1x 12x 12x 12x 12x 12x 12x 12x 12x 1x 1x 1x 1x 38x 38x 1x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 1x 1x 67x 64x 67x 1x 1x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x | export const formatDate = (isoStr) => { const date = new Date(isoStr); return date.toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit', }) + ' ' + date.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit', }); }; export const pad = (num, padLength = 3) => String(num).padStart(padLength, ' '); export const plural = (count, singular, plural, padLength = 1) => { return `${pad(count, padLength)} ${count > 1 ? plural : singular}`; } export const secondsToHms = (nbSeconds) => { nbSeconds = Number(nbSeconds); let h = Math.floor(nbSeconds / 3600); let m = Math.floor(nbSeconds % 3600 / 60); let s = Math.floor(nbSeconds % 3600 % 60); let hDisplay = h !== 0 ? (Math.abs(h) + "h ") : ""; let mDisplay = m !== 0 ? (Math.abs(m) + "min ") : ""; let sDisplay = s !== 0 ? (Math.abs(s) + "sec") : ""; let result = (nbSeconds < 0 ? "-" : "") + hDisplay + mDisplay + sDisplay; return result === "" ? "none" : result; } export const intValueOf = mixed => { if (isNaN(mixed) || mixed === null || mixed === undefined) return 0; return mixed; } export const formatSession = sess => { const { browser, os, screen, language, country, subdivision1, city, firstAt, lastAt, visits, views } = sess; const loc = `${country}${city ? ` ${subdivision1 || ''} ${city}` : ''}`; const period = `${formatDate(firstAt)} - ${formatDate(lastAt)}`; const view_s = plural(views, 'view ', 'views', 3); const visit_s = plural(visits, 'visit ', 'visits', 3); return ` - ${view_s} ${visit_s} | period: ${period} | ${loc.trim()} (${language}) with ${os} ${browser} ${screen}`; } |