def calendar_date_select(object, method, options={})
obj = options[:object] || instance_variable_get("@#{object}")
if !options.include?(:time) && obj.class.respond_to?("columns_hash")
column_type = (obj.class.columns_hash[method.to_s].type rescue nil)
options[:time] = true if column_type == :datetime
end
use_time = options[:time]
if options[:time].to_s=="mixed"
use_time = false if Date===(obj.respond_to?(method) && obj.send(method))
end
image, options, javascript_options = calendar_date_select_process_options(options)
options[:value] ||=
if(obj.respond_to?(method) && obj.send(method).respond_to?(:strftime))
obj.send(method).strftime(CalendarDateSelect.date_format_string(use_time))
elsif obj.respond_to?("#{method}_before_type_cast")
obj.send("#{method}_before_type_cast")
elsif obj.respond_to?(method)
obj.send(method).to_s
else
nil
end
tag = ActionView::Helpers::InstanceTag.new_with_backwards_compatibility(object, method, self, options.delete(:object))
calendar_date_select_output(
tag.to_input_field_tag( (javascript_options[:hidden] || javascript_options[:embedded]) ? "hidden" : "text", options),
image,
options,
javascript_options
)
end