<commit_before>import moment from 'moment'

export default function timeAgoFormatted(patientJoinedAt) {
  try {
    const joinedAt = moment(patientJoinedAt)

    if (!joinedAt.isValid()) {
      return ''
    }

    const now = moment()

    const twoMinutesFromJoin = moment(joinedAt).add(2, 'minutes')
    const oneHourFromJoin = moment(joinedAt).add(1, 'hour')
    const oneDayFromJoin = moment(joinedAt).add(1, 'day')

    if (now.isAfter(oneDayFromJoin)) {
      const daysDiff = now.diff(joinedAt, 'days')
      const unit = daysDiff >= 2 ? 'DAYS' : 'DAY'
      return `${daysDiff} ${unit}`
    } else if (now.isAfter(oneHourFromJoin)) {
      const hoursDiff = now.diff(joinedAt, 'hours')
      const unit = hoursDiff > 1 ? 'HOURS' : 'HOUR'
      return `${hoursDiff} ${unit}`
    } else if (now.isAfter(twoMinutesFromJoin)) {
      const minutesDiff = now.diff(joinedAt, 'minutes')
      return `${minutesDiff} MIN`
    } else {<commit_msg>Rename timeAgoFormatted args<commit_after>import moment from 'moment'

export default function timeAgoFormatted(t: string) {
  try {
    const time = moment(t)

    if (!time.isValid()) {
      return ''
    }

    const now = moment()

    const twoMinutesFromJoin = moment(time).add(2, 'minutes')
    const oneHourFromJoin = moment(time).add(1, 'hour')
    const oneDayFromJoin = moment(time).add(1, 'day')

    if (now.isAfter(oneDayFromJoin)) {
      const daysDiff = now.diff(time, 'days')
      const unit = daysDiff >= 2 ? 'DAYS' : 'DAY'
      return `${daysDiff} ${unit}`
    } else if (now.isAfter(oneHourFromJoin)) {
      const hoursDiff = now.diff(time, 'hours')
      const unit = hoursDiff > 1 ? 'HOURS' : 'HOUR'
      return `${hoursDiff} ${unit}`
    } else if (now.isAfter(twoMinutesFromJoin)) {
      const minutesDiff = now.diff(time, 'minutes')
      return `${minutesDiff} MIN`
    } else {
{'fraction_non_alphanumeric': 0.1436256051640667, 'fraction_numerical': 0.0053792361484669175, 'mean_word_length': 3.3055555555555554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4518571', 'n_tokens_mistral': 635, 'n_tokens_neox': 622, 'n_words': 147}