Sha256: fcefbce01c30acb2355af1f87f0e70a5db672249582504aa31a362ca06381a4f

Contents?: true

Size: 534 Bytes

Versions: 47

Compression:

Stored size: 534 Bytes

Contents

module Fields::DateAndTimeSupport
  extend ActiveSupport::Concern

  def assign_date_and_time(strong_params, attribute)
    attribute = attribute.to_s
    time_zone_attribute = "#{attribute}_time_zone"
    if strong_params.dig(attribute).present?
      time_zone = ActiveSupport::TimeZone.new(strong_params[time_zone_attribute] || current_team.time_zone)
      strong_params.delete(time_zone_attribute)
      strong_params[attribute] = time_zone.strptime(strong_params[attribute], t("global.formats.date_and_time"))
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
bullet_train-fields-1.2.9 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.8 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.7 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.6 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.5 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.4 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.3 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.2 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.1 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.0 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.19 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.18 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.17 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.15 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.14 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.13 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.12 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.10 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.8 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.0.7 app/controllers/concerns/fields/date_and_time_support.rb