Sha256: 8e90a7765224be38d084690b6a03ae5d8f37c4c7bad2f0999379b4842ae4891c
Contents?: true
Size: 741 Bytes
Versions: 2
Compression:
Stored size: 741 Bytes
Contents
module TwelveHourTime module AR def self.included(base) base.extend(ClassMethods) end module ClassMethods 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 super end end end end if defined? ActiveRecord ActiveRecord::Base.class_eval do include TwelveHourTime::AR end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
12_hour_time-0.0.3 | lib/12_hour_time/active_record_modifications.rb |
12_hour_time-0.0.2 | lib/12_hour_time/active_record_modifications.rb |