ML
invites.sort_by! { |invite| (call['Timestamp']-invite['time']).to_i.abs }
array = ['2020-09-05 14:23:57'.to_time, '2020-09-05 15:44:32'.to_time, '2020-09-05 15:46:03'.to_time, '2020-09-05 15:46:44'.to_time]
base = '2020-09-05 15:46:11'.to_time
closest = Float::INFINITY
i = 0
while i < array.size do
temp = (array[i] - base).abs
if temp < closest
closest = temp
result = array[i]
end
i +=1
end
result