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 | 10x 8x 8x 8x 8x 8x 8x 8x 8x 8x 10x 8x 8x | export const getTimeDifference = (date) => { const millisec = new Date(Date.now()).getTime() - new Date(date).getTime(); var seconds = (millisec / 1000).toFixed(1); var minutes = (millisec / (1000 * 60)).toFixed(1); var hours = (millisec / (1000 * 60 * 60)).toFixed(1); var days = (millisec / (1000 * 60 * 60 * 24)).toFixed(1); Iif (seconds < 60) { if(seconds<0){ return "Just now"; } return `${parseInt(seconds)} Sec ago`; } else Iif (minutes < 60) { return `${parseInt(minutes)} Min ago`; } else Iif (hours < 24) { return `${parseInt(hours)} Hrs ago`; } else { return `${parseInt(days)} Days ago`; } }; export const getHoursFromTimestamp = (stamp) => { let date = new Date(stamp) return getTimeDifference(date) } |