2
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/12_hour_time/active_record_modifications.rb', line 2
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
|