export const getTimeDifference = (eventTimestamp: string) => {
  const date = parseFloat(eventTimestamp)
  const diff = new Date().getTime() - date

  const days = Math.floor(diff / (1000 * 60 * 60 * 24))
  const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
  const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))

  if (days > 0) {
    return `${days} day${days > 1 ? 's' : ''} ago`
  }
  if (hours > 0) {
    return `${hours} hour${hours > 1 ? 's' : ''} ago`
  }
  if (minutes > 1) {
    return `${minutes} minutes ago`
  }
  return 'Just now'
}
