Module: BootstrapForm::Datetimepicker

Defined in:
lib/bootstrap_form/datetimepicker.rb

Instance Method Summary collapse

Instance Method Details

#date_field(name, *args) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/bootstrap_form/datetimepicker.rb', line 3

def date_field(name, *args)
  options = args.extract_options!.symbolize_keys!
  prepare_options(name, options)
  options[:input_group][:data].merge!({'date-format' => 'L', 'date-extra-formats' => [BootstrapForm::DATE_FORMAT_JS]}.merge(options[:data] || {}))
  append_min_max(BootstrapForm::DATE_FORMAT_RUBY, options)
  args << options
  super
end

#datetime_local_field(name, *args) ⇒ Object Also known as: datetime_field

def datetime_field(name, *args)

  options = args.extract_options!.symbolize_keys!
  options[:datetimepicker] = true
  options[:append] = calendar_addon
  args << options
  super
end


20
21
22
23
24
25
26
27
# File 'lib/bootstrap_form/datetimepicker.rb', line 20

def datetime_local_field(name, *args)
  options = args.extract_options!.symbolize_keys!
  prepare_options(name, options)
  options[:input_group][:data].merge!({'date-extra-formats' => [BootstrapForm::DATE_FORMAT_JS+"THH:mm"+(options[:include_seconds] ? ':ss' : '')]}.merge(options[:data] || {}))
  append_min_max(BootstrapForm::DATE_FORMAT_RUBY+"T%T", options)
  args << options
  super
end