# Datetime\_select custom input fields

**URL:** <https://www.ruby-forum.com/t/datetime-select-custom-input-fields/134759>\
**Category:** Rails\
**Created:** [April 14, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/datetime-select-custom-input-fields/134759 "2008-04-14T21:28:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phil\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b4bc9f/32.png) [@Phil\_U](https://www.ruby-forum.com/u/Phil_U)\
**Post date:** [April 14, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/datetime-select-custom-input-fields/134759/1 "2008-04-14T21:28:45Z")

</div>

by default datetime\_select allows the user to input any date and time  
they want.

Is there a way it can only allow a user to select an hour between 8AM  
and 6PM and only allow them to choose the top of the hour (:00) and  
the half hour (:30) for the minute?

---

<div class="post-metadata">

**Author:** ![Phil\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b4bc9f/32.png) [@Phil\_U](https://www.ruby-forum.com/u/Phil_U)\
**Post date:** [April 15, 2008, 9:11am UTC](https://www.ruby-forum.com/t/datetime-select-custom-input-fields/134759/2 "2008-04-15T09:11:57Z")

</div>

Phil U wrote:

> by default datetime\_select allows the user to input any date and time  
> they want.
> 
> Is there a way it can only allow a user to select an hour between 8AM  
> and 6PM and only allow them to choose the top of the hour (:00) and  
> the half hour (:30) for the minute?

Build your own?

---

<div class="post-metadata">

**Author:** ![Phil\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b4bc9f/32.png) [@Phil\_U](https://www.ruby-forum.com/u/Phil_U)\
**Post date:** [April 23, 2008, 8:09pm UTC](https://www.ruby-forum.com/t/datetime-select-custom-input-fields/134759/3 "2008-04-23T20:09:45Z")

</div>

Hi, Phil.

I haven’t yet found a way to show a 12-hour clock unless you try the  
Flextimes plugin ([http://flextimes.rubyforge.org/](http://flextimes.rubyforge.org/)), which I haven’t  
tried yet.

The second part of your question is easy to answer. Use  
the :minute\_step=\>nn option, where nn is the number of minutes you  
want for each “step”. In your case, set to to 30.
