# Validation date

**URL:** <https://www.ruby-forum.com/t/validation-date/104781>\
**Category:** Rails\
**Created:** [May 22, 2007, 1:44pm UTC](https://www.ruby-forum.com/t/validation-date/104781 "2007-05-22T13:44:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alabama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/858c86/32.png) [@alabama](https://www.ruby-forum.com/u/alabama)\
**Post date:** [May 22, 2007, 1:44pm UTC](https://www.ruby-forum.com/t/validation-date/104781/1 "2007-05-22T13:44:46Z")

</div>

Hi everybody !  
I can’t find validation for date.  
In my form I use form.date\_select.  
How I can protect this field from selection for egzample “month-\>  
February, day -\> 30”.  
ActiveRecord don’t save it, but error will raise. I would like to serve  
this error in this same way as other kind of validation.  
Similar problem is when we have  
form.date\_select :date\_attribute, {:include\_blank =\> true}.  
Then strange date save possibly, when not all three parts was selected,  
for egzample only month but not year and day. Always first part is as  
year and missing data are filled with 1.  
How I can via validation indicate my user which part of date he/she has  
forgetten fill.  
Theoretically we have validates\_format\_of with option :with, but I  
couldn’t find it as useful in this case. Maybe I’m wrong.  
What kind of strategy I should choice?

---

<div class="post-metadata">

**Author:** ![alabama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/858c86/32.png) [@alabama](https://www.ruby-forum.com/u/alabama)\
**Post date:** [May 22, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/validation-date/104781/2 "2007-05-22T15:59:32Z")

</div>

I use the calendar control from [http://datetime.toolbocks.com/](http://datetime.toolbocks.com/). It  
takes care of preventing invalid dates such as February 30th.

On May 22, 7:44 pm, Walde M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![alabama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/858c86/32.png) [@alabama](https://www.ruby-forum.com/u/alabama)\
**Post date:** [May 23, 2007, 6:54am UTC](https://www.ruby-forum.com/t/validation-date/104781/3 "2007-05-23T06:54:07Z")

</div>

If you check the TRUNK, you’ll notice it will solve any RJS problems  
you may have had with older versions causing errors. Also couple fixes  
in there for Modal windows so it shows up on top.

Official release coming soon! 🙂

Nathaniel.

On 5/22/07, Myron M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > How I can protect this field from selection for egzample "month-\>  
> > Theoretically we have validates\_format\_of with option :with, but I  
> > couldn’t find it as useful in this case. Maybe I’m wrong.  
> > What kind of strategy I should choice?
> > 
> > –  
> > Posted viahttp://www.ruby-forum.com/.
> 
> >

–  
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647  
Vancouver: 604-724-6624
