# Problems with date\_select

**URL:** <https://www.ruby-forum.com/t/problems-with-date-select/142536>\
**Category:** Rails\
**Created:** [July 8, 2008, 11:48pm UTC](https://www.ruby-forum.com/t/problems-with-date-select/142536 "2008-07-08T23:48:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [July 8, 2008, 11:48pm UTC](https://www.ruby-forum.com/t/problems-with-date-select/142536/1 "2008-07-08T23:48:28Z")

</div>

Is is possible to have both a default value specified, and to include  
a blank in a date\_select?

\<%= date\_select(‘birthday\_date’, ‘value’, {:default =\>  
birthday, :start\_year =\> 1900, :end\_year =\> Time.now.year, :order =\>  
[:month, :day, :year], :include\_blank =\> true, }) %\>

This should technically include a blank option, and when the page  
loads it should select to the date that is being passed in.

However, when I pass in a valid birthday that is a DateTime object,  
the select defaults to the blank values instead of the dates in the  
datetime object. If I take out the :include\_blank =\> true statement,  
it default to the birthday correctly.

Is this intended functionality? If so, is there any way to achieve  
what I am trying to do?

Thanks.

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [July 9, 2008, 12:17am UTC](https://www.ruby-forum.com/t/problems-with-date-select/142536/2 "2008-07-09T00:17:29Z")

</div>

It seems to be that “birthday\_date” may not be an object but a  
variable.  
date\_select expects an object\_name as the first parameter and the  
method in the second  
date\_select(object\_name, method, options)

If you are not passing in an object, perhaps you should try  
select\_date helper instead. Something like:  
select\_date(birthday\_date, { :start\_year =\> 1900, :end\_year =\>  
Time.now.year, :order =\>

> [:month, :day, :year], :include\_blank =\> true, })

Just my guess.

steve
