# Nil dates in selct\_date

**URL:** <https://www.ruby-forum.com/t/nil-dates-in-selct-date/132167>\
**Category:** Rails\
**Created:** [March 17, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/nil-dates-in-selct-date/132167 "2008-03-17T15:47:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [March 17, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/nil-dates-in-selct-date/132167/1 "2008-03-17T15:47:05Z")

</div>

Can one specify to date\_select that a nil value is permitted and is the  
default value? Is it possible to add nil to the list of permitted  
values in a date\_select call? The code in  
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action\_view/helpers/date\_helper.rb  
seems to treat nil as now.

```
654 def default_time_from_options(default)
655 case default
656 when nil
657 Time.now
658 when Date, Time
659 default

```

I have a situation where a record may have a superseded date but which  
is left as null if the date is not set. It is also possible that the  
value may need to be reset to nil if the record is activated again. I  
would like to retain the convenience of the date picker in rails but I  
need to ahve this functionality. How does one accomplish this?
