<commit_before>require 'ventana/i18n'

module Ventana
  extend self

  def date_format(from,to)
    format = if to.year > from.year
      # must show year difference
      "full_dates"
    elsif to.month > from.month
      # must show month difference
      "single_year"
    elsif to.day > from.day
      # within the same month
      "single_month"
    else
      # within the same day
      "single_day"
    end

    if Ventana.show_days?(from,to)
      format << "_with_days"
    else
      format << "_without_days"
    end unless format == "single_day"

    format
  end

  def time_format(from,to)
    
  end

  def show_days?(from,to)
    from.day != 1 || to.day != case to.month
                                when 1,3,5,7,8,10,12 then 31
                                when 4,6,9,11 then 30
                                else
                                  if (to.year % 4) == 0
                                    29
                                  else
                                    28
                                  end
                                end
  end

  def time_format(date)
    str = date.strftime "%l"
    if date.min > 0
      str << ":" << date.strftime("%M")
    end
    str << "" << date.strftime("%p")

    str.strip
  end

  def show_time?(from,to)
    from.hour != 0 ||
      from.minutes != 0 ||
      from.seconds != 0 ||
      to.hour != 12 ||
      to.minutes != 0 ||
      to.seconds != 0
  end
end

def Ventana(from,to,options={})
  raise ArgumentError, "#{from} is bigger than #{to}" if from > to 

  date = I18n.t(Ventana.date_format(from,to), {
    from_year: from.year,
    from_month: I18n.t('ventana.month_names')[from.month],
    from_day: from.day,
    to_year: to.year,
    to_month: I18n.t('ventana.month_names')[to.month],
    to_day: to.day,
    scope: :ventana
  })

  time = I18n.t(:time_difference, { 
    from_time: Ventana.time_format(from),
    to_time: Ventana.time_format(to),<commit_msg>Minor "protocolar" change on time format<commit_after>require 'ventana/i18n'

module Ventana
  extend self

  def date_format(from,to)
    format = if to.year > from.year
      # must show year difference
      "full_dates"
    elsif to.month > from.month
      # must show month difference
      "single_year"
    elsif to.day > from.day
      # within the same month
      "single_month"
    else
      # within the same day
      "single_day"
    end

    if Ventana.show_days?(from,to)
      format << "_with_days"
    else
      format << "_without_days"
    end unless format == "single_day"

    format
  end

  def time_format(from,to)
    
  end

  def show_days?(from,to)
    from.day != 1 || to.day != case to.month
                                when 1,3,5,7,8,10,12 then 31
                                when 4,6,9,11 then 30
                                else
                                  if (to.year % 4) == 0
                                    29
                                  else
                                    28
                                  end
                                end
  end

  def time_format(date)
    date.strftime("%l:%M %P").strip
  end

  def show_time?(from,to)
    from.hour != 0 ||
      from.minutes != 0 ||
      from.seconds != 0 ||
      to.hour != 12 ||
      to.minutes != 0 ||
      to.seconds != 0
  end
end

def Ventana(from,to,options={})
  raise ArgumentError, "#{from} is bigger than #{to}" if from > to 

  date = I18n.t(Ventana.date_format(from,to), {
    from_year: from.year,
    from_month: I18n.t('ventana.month_names')[from.month],
    from_day: from.day,
    to_year: to.year,
    to_month: I18n.t('ventana.month_names')[to.month],
    to_day: to.day,
    scope: :ventana
  })

  time = I18n.t(:time_difference, { 
    from_time: Ventana.time_format(from),
    to_time: Ventana.time_format(to),
{'fraction_non_alphanumeric': 0.11206448257930317, 'fraction_numerical': 0.022100884035361413, 'mean_word_length': 1.5544488711819389, 'pattern_counts': {'":': 1, '<': 19, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5485326', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1231, 'n_words': 288}