<commit_before>module TimeHelper

  # Our goal here it to automatically display the date in the way that
  # makes the most sense. Elusive, i know. If an array of times is passed in
  # we display the newest one. 
  # Here are the current options:
  #   4:30PM    -- time was today
  #   Wednesday -- time was within the last week.
  #   7/Mar     -- time was in the current year.
  #   7/Mar/08  -- time was in a different year.
  # The date is then wrapped in a label, so that if you hover over the text
  # you will see the full details.
  def friendly_date(*times)
    return "" unless times.any?

    time  = times.compact.max
    today = Time.zone.today
    date  = time.to_date
    
    if date == today
      # 4:30PM
      str = time.strftime("%I:%M<span>%p</span>")
    elsif today > date and (today-date) < 7
      # Wednesday
      str = time.strftime("%A").t
    elsif date.year != today.year
      # 7/Mar/08
      str = date.strftime('%d') + '/' + localize_month(date.strftime('%B')) + '/' + date.strftime('%y')
    else
      # 7/Mar
      str = date.strftime('%d') + '/' + localize_month(date.strftime('%B'))
    end
    "<label class='date' title='#{ full_time(time) }'>#{str}</label>"
  end
  
  def localize_month(month)
    month[('month_short_'+month.downcase).to_sym]
  end

  # formats a time, in full detail
  # for example: Sunday July/3/2007 2:13PM PST
  def full_time(time)
    time.strftime('%a %b %d %H:%M:%S %Z %Y')
  end

#  def to_local(time)
#    Time.zone.utc_to_local(time)
#  end
    
  def to_utc(time)
    Time.zone.local_to_utc(time)
  end

  def local_now
    Time.zone.now
  end

  def after_day_start?(time)
    local_now.at_beginning_of_day < time
  end
  
  def after_yesterday_start?(time)<commit_msg>changed format of full_time helper.<commit_after>module TimeHelper

  # Our goal here it to automatically display the date in the way that
  # makes the most sense. Elusive, i know. If an array of times is passed in
  # we display the newest one. 
  # Here are the current options:
  #   4:30PM    -- time was today
  #   Wednesday -- time was within the last week.
  #   7/Mar     -- time was in the current year.
  #   7/Mar/08  -- time was in a different year.
  # The date is then wrapped in a label, so that if you hover over the text
  # you will see the full details.
  def friendly_date(*times)
    return "" unless times.any?

    time  = times.compact.max
    today = Time.zone.today
    date  = time.to_date
    
    if date == today
      # 4:30PM
      str = time.strftime("%I:%M<span>%p</span>")
    elsif today > date and (today-date) < 7
      # Wednesday
      str = time.strftime("%A").t
    elsif date.year != today.year
      # 7/Mar/08
      str = date.strftime('%d') + '/' + localize_month(date.strftime('%B')) + '/' + date.strftime('%y')
    else
      # 7/Mar
      str = date.strftime('%d') + '/' + localize_month(date.strftime('%B'))
    end
    "<label class='date' title='#{ full_time(time) }'>#{str}</label>"
  end
  
  def localize_month(month)
    month[('month_short_'+month.downcase).to_sym]
  end

  # formats a time, in full detail
  # for example: Sunday 2007/July/3 2:13PM PST
  def full_time(time)
    time.strftime('%A %Y/%b/%d %I:%M%p')
  end

#  def to_local(time)
#    Time.zone.utc_to_local(time)
#  end
    
  def to_utc(time)
    Time.zone.local_to_utc(time)
  end

  def local_now
    Time.zone.now
  end

  def after_day_start?(time)
    local_now.at_beginning_of_day < time
  end
  
  def after_yesterday_start?(time)
{'fraction_non_alphanumeric': 0.12784738041002278, 'fraction_numerical': 0.013097949886104784, 'mean_word_length': 2.6404145077720207, 'pattern_counts': {'":': 0, '<': 15, '<?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': '7557613', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1249, 'n_words': 354}