Forum: Ruby on Rails Default Value for date_select helper

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fa06489a97b0efe3c3b7d249982878d3?d=identicon&s=25 David Hughes (divotdave)
on 2006-06-01 20:42
Hi All:

Just curious if anyone has figured out how to set a default date for the
date_select helper.

My application has a form with both a start date and end date select for
the user. Since the period between the two is a minimum of 24 hours I
wanted to have the start date default to Date.today (which it does
automatically) and then have the end date default to the following date
(i.e. start date = 06/01/2006; end date = 06/02/2006).

Any ideas?

Thanks!
90842970ceaf7ed19136ce7b6f8e1455?d=identicon&s=25 Michael Daines (Guest)
on 2006-06-02 05:42
(Received via mailing list)
> My application has a form with both a start date and end date
> select for
> the user. Since the period between the two is a minimum of 24 hours I
> wanted to have the start date default to Date.today (which it does
> automatically) and then have the end date default to the following
> date
> (i.e. start date = 06/01/2006; end date = 06/02/2006).

If the period between them must be a minimum of 24 hours and you're
selecting a date rather and a date and time, why do you need a date
select box for the second date? Given any start date, you only have
two options for the end date: the same day and the day after.


--
Michael Daines
http://www.mdaines.com
This topic is locked and can not be replied to.