Sha256: 478480fe66074e6794d82a973d1358e501afb8b509dfe1f353ff95bc8e07f9f6

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

class ActiveRecord::Base
  def instantiate_time_object_with_ampm(name, values)
    if values.last < 0
      hour_idx = ActionView::Helpers::DateTimeSelector::POSITION[:hour] - 1
      ampm = values.pop
      if ampm == ActionView::Helpers::DateTimeSelector::AM and values[hour_idx] == 12
        values[hour_idx] = 0
      elsif ampm == ActionView::Helpers::DateTimeSelector::PM and values[hour_idx] != 12
        values[hour_idx] += 12
      end
    end

    instantiate_time_object_without_ampm(name, values)
  end

  alias_method_chain :instantiate_time_object, :ampm
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
12_hour_time-0.0.4 lib/12_hour_time/active_record_modifications.rb