lib/jqr-helpers/helpers.rb in jqr-helpers-1.0.70 vs lib/jqr-helpers/helpers.rb in jqr-helpers-1.0.71

- old
+ new

@@ -296,10 +296,13 @@ # @param options [Hash] options to be passed to datepicker(). # @param html_options [Hash] options to be passed to text_field_tag. # @return [String] def date_picker_tag(name, value=Date.today, options={}, html_options={}) format = options.delete(:format) || '%Y-%m-%d' - value = value.strftime(format) if value.present? + if value.present? + value = Date.parse(value) if value.is_a?(String) + value = value.strftime(format) + end options[:dateFormat] = _map_date(format) html_options[:'data-date-options'] = options.to_json html_options[:class] ||= '' html_options[:class] << ' ujs-date-picker' text_field_tag(name, value, html_options)