# Date validation :before -1 day

**URL:** <https://www.ruby-forum.com/t/date-validation-before-1-day/135807>\
**Category:** Rails\
**Created:** [April 25, 2008, 5:55am UTC](https://www.ruby-forum.com/t/date-validation-before-1-day/135807 "2008-04-25T05:55:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shikha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bcef8e/32.png) [@shikha](https://www.ruby-forum.com/u/shikha)\
**Post date:** [April 25, 2008, 5:55am UTC](https://www.ruby-forum.com/t/date-validation-before-1-day/135807/1 "2008-04-25T05:55:34Z")

</div>

I really liked the tool but I have got stuck in one case. I am in urgent  
need of your help regarding

validates\_date :sale\_start, :before =\> :sale\_end,  
:after =\> Proc.new { -1.day.from\_now.to\_date }

validates\_date :sale\_end, :after =\> [:sale\_start ,  
Proc.new {  
-1.day.from\_now.to\_date }],

This is Okay but there may be the same date as of sale\_end. Means a sale  
can be for a single day, in that case sale\_start and sale\_end both  
fields may have the same date but this syntax or :after property does  
not allow me to do so. It accepts only one day after the sale\_start  
date. So will you please suggest me how can I set it as the same day.

Your help will be appreciated.

Thanks!
