From 213ab9a9b31456db45c00dd010a8282d4f43b5c6 Mon Sep 17 00:00:00 2001 From: Sylvain Gautier Date: Wed, 1 Apr 2015 11:22:54 +0200 Subject: [PATCH 1/2] Specify seconds for Time creation Otherwise the current system seconds is used --- lib/reform/form/multi_parameter_attributes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reform/form/multi_parameter_attributes.rb b/lib/reform/form/multi_parameter_attributes.rb index 087d694f..d01004b0 100644 --- a/lib/reform/form/multi_parameter_attributes.rb +++ b/lib/reform/form/multi_parameter_attributes.rb @@ -36,7 +36,7 @@ def params_to_date(year, month, day, hour, minute) if hour.blank? && minute.blank? Date.new(year.to_i, month.to_i, day.to_i) # TODO: test fails. else - args = [year, month, day, hour, minute].map(&:to_i) + args = [year, month, day, hour, minute, 0].map(&:to_i) Time.zone ? Time.zone.local(*args) : Time.new(*args) end From a8b7b99305b3158630df378291debbd087fc749a Mon Sep 17 00:00:00 2001 From: Sylvain Gautier Date: Wed, 1 Apr 2015 11:44:43 +0200 Subject: [PATCH 2/2] Debugging --- lib/reform/form/multi_parameter_attributes.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/reform/form/multi_parameter_attributes.rb b/lib/reform/form/multi_parameter_attributes.rb index d01004b0..05117e05 100644 --- a/lib/reform/form/multi_parameter_attributes.rb +++ b/lib/reform/form/multi_parameter_attributes.rb @@ -36,6 +36,8 @@ def params_to_date(year, month, day, hour, minute) if hour.blank? && minute.blank? Date.new(year.to_i, month.to_i, day.to_i) # TODO: test fails. else + Rails.logger.info "Debugging" + Rails.logger.info [year, month, day, hour, minute, 0] args = [year, month, day, hour, minute, 0].map(&:to_i) Time.zone ? Time.zone.local(*args) : Time.new(*args)