Re: date_select oddness [SOLVED]

Tomasz Bąk
Thu, 01 Dec 2005 15:45:03 -0000

Tomasz Bąk w:
> Hello,
> I have a problem when with this tag in view:
>   <%= date_select :customdate, nil %>
I have changed it into:
   <%= date_select :row, :customdate %>

> The problem is the :customdate doesnt get transformed
> into Date, instead I get this:
>   {"(3i)"=>"29",
"(1i)"=>"2005", "(2i)"=>"11"}
With this little function

def date_select_to_date(struct,name)
   Date.new(struct["#{name}(1i)"].to_i,
     struct["#{name}(2i)"].to_i,
     struct["#{name}(3i)"].to_i)
end

I can get the date in the controller:

   d = date_select_to_date(params[:row],''customdate '')

Tom.