Sha256: 81792219b7880ef608e370e8050e0bdd5e5eb6f844d0b604924a3ad856e01ac7

Contents?: true

Size: 556 Bytes

Versions: 10

Compression:

Stored size: 556 Bytes

Contents

module CommonCoreJs
  module ControllerHelper
    def modify_date_inputs_on_params(modified_params)
      use_timezone = current_account.timezone || Time.now.strftime("%z")

      modified_params = modified_params.tap do |params|
        params.keys.each{|k|
          if k.ends_with?("_at") || k.ends_with?("_date")

            begin
              params[k] = DateTime.strptime("#{params[k]} #{use_timezone}", '%Y-%m-%dT%H:%M %z')
            rescue StandardError

            end
          end
        }
      end
      modified_params
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
common_core_js-0.4.7 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.4.6 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.4.4 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.4.3 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.4.2 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.4.1 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.4.0 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.3.9 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.3.8 app/helpers/common_core_js/controller_helper.rb
common_core_js-0.3.7 app/helpers/common_core_js/controller_helper.rb