# Date\_select for valid days only. No Feb 30

**URL:** <https://www.ruby-forum.com/t/date-select-for-valid-days-only-no-feb-30/100762>\
**Category:** Rails\
**Created:** [July 31, 2006, 11:12pm UTC](https://www.ruby-forum.com/t/date-select-for-valid-days-only-no-feb-30/100762 "2006-07-31T23:12:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mansfiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@mansfiem](https://www.ruby-forum.com/u/mansfiem)\
**Post date:** [July 31, 2006, 11:12pm UTC](https://www.ruby-forum.com/t/date-select-for-valid-days-only-no-feb-30/100762/1 "2006-07-31T23:12:00Z")

</div>

I am looking for some advice on how to make a date select display only  
valid days of the year. The standard date helper allows for you to  
choose 31 days for every month of the year. Since not all months have  
31 days this can lead to invalid date entries for scheduling.

I am thinking that an approach where I have a drop down for month and  
then use AJAX or normal client side javascript to update a day drop down  
is the way to do things. Has anyone released any code that does this?

Thank you,  
Matthew M.  
[blog.mattmargolis.net](http://blog.mattmargolis.net)

---

<div class="post-metadata">

**Author:** ![mansfiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@mansfiem](https://www.ruby-forum.com/u/mansfiem)\
**Post date:** [July 31, 2006, 11:43pm UTC](https://www.ruby-forum.com/t/date-select-for-valid-days-only-no-feb-30/100762/2 "2006-07-31T23:43:52Z")

</div>

Matthew,

Have you considered using the date\_box engine? The popup has the days  
of month correct.

Regards,

Michael

---

<div class="post-metadata">

**Author:** ![mansfiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@mansfiem](https://www.ruby-forum.com/u/mansfiem)\
**Post date:** [August 1, 2006, 12:29am UTC](https://www.ruby-forum.com/t/date-select-for-valid-days-only-no-feb-30/100762/3 "2006-08-01T00:29:56Z")

</div>

Michael M. wrote:

> Matthew,
> 
> Have you considered using the date\_box engine? The popup has the days  
> of month correct.
> 
> Regards,
> 
> Michael

While interesting this does not quite meet my needs. I require a date  
selector that is a drop down or calendar view, the whole text box entry  
thing won’t fly for my current project.

Any other suggestions for date selectors that only show days that  
actually exist?

Matthew M.  
[blog.mattmargolis.net](http://blog.mattmargolis.net)

---

<div class="post-metadata">

**Author:** ![mansfiem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@mansfiem](https://www.ruby-forum.com/u/mansfiem)\
**Post date:** [August 1, 2006, 1:12am UTC](https://www.ruby-forum.com/t/date-select-for-valid-days-only-no-feb-30/100762/4 "2006-08-01T01:12:03Z")

</div>

Hi Matthew,

date\_box is a calendar view based on the dynarch js calendar! While it  
is true it is surrounded by a text input field, you can easily disable  
the field so that a user doesn’t type into it. The Calendar image goes  
right next to the field, but you could change that too so that the  
onclick of the field itself pops up the calendar. The calendar is very  
nice looking and it is themed so you can change the look and feel if so  
desired.

Anyway, just my suggestion. If you want to see a screenshot of the way  
it looks then let me know and I’ll email you one privately. codeslush  
at yahoo dot com

Note - I just made changes to date\_box engine and posted an entry here  
last night with the mod (very basic). The way it all works is fresh in  
my head and would be happy to help you out.

Regards,

Michael
