From 384172bfb84551d9739a151a9f448c00088f9cb4 Mon Sep 17 00:00:00 2001 From: "dr.allgood" Date: Mon, 6 May 2013 01:34:44 +0200 Subject: [PATCH] fixed issue with times between 12pm and 1pm not being calculated correctly into 24h times --- plugins_disabled/facebookifttt.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/plugins_disabled/facebookifttt.rb b/plugins_disabled/facebookifttt.rb index 766073c..041e9dd 100644 --- a/plugins_disabled/facebookifttt.rb +++ b/plugins_disabled/facebookifttt.rb @@ -27,6 +27,8 @@ - You should set facebook_ifttt_input_file to this value, substituting username appropriately. =end +require 'date' + config = { 'description' => ['Parses Facebook posts logged by IFTTT.com', 'facebook_ifttt_input_file is a string pointing to the location of the file created by IFTTT.', @@ -90,14 +92,8 @@ def do_log line = line.gsub(',', '') month, day, year, time = line.split - hour,min = time.split(/:/) - min = min.gsub(ampm, '') - - if line =~ pm - x = hour.to_i - x += 12 - hour = x.to_s - end + parseTime = DateTime.parse(time).strftime("%H:%M") + hour,min = parseTime.split(/:/) month = Date::MONTHNAMES.index(month) ltime = Time.local(year, month, day, hour, min, 0, 0)