# Strange select\_date behavior or possible bug

**URL:** <https://www.ruby-forum.com/t/strange-select-date-behavior-or-possible-bug/92301>\
**Category:** Rails\
**Created:** [April 18, 2007, 1:27am UTC](https://www.ruby-forum.com/t/strange-select-date-behavior-or-possible-bug/92301 "2007-04-18T01:27:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nielsene](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nielsene](https://www.ruby-forum.com/u/nielsene)\
**Post date:** [April 18, 2007, 1:27am UTC](https://www.ruby-forum.com/t/strange-select-date-behavior-or-possible-bug/92301/1 "2007-04-18T01:27:45Z")

</div>

I’m using select\_date to display combo boxes with a date selection and  
I would like to change the selected date to be a day or a week from  
now.

\<%= select\_date (Date.today + 1), :prefix =\> ‘start\_date’ %\>  
\<%= select\_date (Date.today + 7), :prefix =\> ‘start\_date’ %\>

Results in today’s date being used

\<%= select\_date (Date.today + 1), :prefix =\> ‘end\_date’ %\>  
\<%= select\_date (Date.today + 7), :prefix =\> ‘end\_date’ %\>

Results in tomorrow’s date being used. For some reason if the prefix  
includes ‘start’ the date is today otherwise it ends up being tomorrow  
but in all the cases it appears that the passed date is ignored.

select\_day however behaves as expected

\<%= select\_day (Date.today + 1), :prefix =\> ‘end\_date’ %\> =\> combo  
with tomorrow selected  
\<%= select\_day (Date.today + 7), :prefix =\> ‘end\_date’ %\> =\> combo  
with the day for one week from now selected

Has anybody else noticed this? Is this just a bug or am I missing  
something?

---

<div class="post-metadata">

**Author:** ![nielsene](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bc79bd/32.png) [@nielsene](https://www.ruby-forum.com/u/nielsene)\
**Post date:** [April 19, 2007, 1:38am UTC](https://www.ruby-forum.com/t/strange-select-date-behavior-or-possible-bug/92301/2 "2007-04-19T01:38:18Z")

</div>

This was caused by Firefox recording the values set in the combos  
regardless of whether the page was refereshed. When I accessed the  
page via a link versus a referesh the combos worked fine.
