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.3.1 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.3.0 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.27 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.26 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.25 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.24 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.23 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.22 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.21 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.20 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.19 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.18 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.17 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.16 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.15 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.14 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.13 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.12 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.11 app/controllers/concerns/fields/date_and_time_support.rb
bullet_train-fields-1.2.10 app/controllers/concerns/fields/date_and_time_support.rb