<commit_before>class App.PrettyDate

  # human readable time
  @humanTime: (time, escalation, long = true, type = undefined) ->
    return '' if !time
    current = new Date()
    created = new Date(time)
    diff = ( current - created ) / 1000

    escalated = ''
    if escalation
      if diff > 0
        escalated = '-'
      if diff >= 0
        style = 'class="label label-danger"'
      else if diff > -60 * 60
        style = 'class="label label-warning"'

    # remember past/future
    direction = 'future'
    if diff > -1
      direction = 'past'

    # strip not longer needed -
    if diff.toString().match('-')
      diff = diff.toString().replace('-', '')
      diff = parseFloat(diff)

    if diff < 60
      return App.i18n.translateInline('just now')

    if type is undefined && window.App && window.App.Config
      type = window.App.Config.get('pretty_date_format')
    if type is 'absolute' && direction is 'past'
      weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
      weekday = weekdays[created.getDay()]

      months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
      month = months[created.getMonth()]

      # for less than 7 days
      if diff < (60 * 60 * 24 * 7)
        string = "#{App.i18n.translateInline(weekday)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}"
      else if diff < (60 * 60 * 24 * 7) * 365
        string = "#{App.i18n.translateInline(weekday)} #{created.getDate()}. #{App.i18n.translateInline(month)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}"
      else
        string = "#{App.i18n.translateInline(weekday)} #{App.i18n.translateTimestamp(time)}"
      if escalation<commit_msg>Improved pretty date - absolute time format (only show no year if date is in same year + only show no weekday if date is less then 6 days).<commit_after>class App.PrettyDate

  # human readable time
  @humanTime: (time, escalation, long = true, type = undefined) ->
    return '' if !time
    current = new Date()
    created = new Date(time)
    diff = ( current - created ) / 1000

    escalated = ''
    if escalation
      if diff > 0
        escalated = '-'
      if diff >= 0
        style = 'class="label label-danger"'
      else if diff > -60 * 60
        style = 'class="label label-warning"'

    # remember past/future
    direction = 'future'
    if diff > -1
      direction = 'past'

    # strip not longer needed -
    if diff.toString().match('-')
      diff = diff.toString().replace('-', '')
      diff = parseFloat(diff)

    if diff < 60
      return App.i18n.translateInline('just now')

    if type is undefined && window.App && window.App.Config
      type = window.App.Config.get('pretty_date_format')
    if type is 'absolute' && direction is 'past'
      weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
      weekday = weekdays[created.getDay()]

      months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
      month = months[created.getMonth()]

      # for less than 6 days
      # weekday HH::MM
      if diff < (60 * 60 * 24 * 6)
        string = "#{App.i18n.translateInline(weekday)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}"
      # if it was this year
      # weekday DD. MM HH::MM
      else if created.getYear() is current.getYear()
        string = "#{App.i18n.translateInline(weekday)} #{created.getDate()}. #{App.i18n.translateInline(month)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}"
      # if it was the year before
      # weekday YYYY-MM-DD HH::MM
      else
        string = "#{App.i18n.translateInline(weekday)} #{App.i18n.translateTimestamp(time)}"
      if escalation
{'fraction_non_alphanumeric': 0.16108452950558214, 'fraction_numerical': 0.0215311004784689, 'mean_word_length': 2.7592407592407593, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 13, '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': '3224738', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1185, 'n_words': 334}