I added a start_hour and end_hour feature to my simple time select. Here are the details from the README:
Simple time select also takes a start_hour and end_hour option to be specified in military format (between 0-23).
<%= time_select "event", "time", { :default => Time.now.change(:hour => 21), :simple_time_select => true, :minute_interval => 20, :time_separator => "", :start_hour => 10, :end_hour => 14 } %>
The start hour behaves as you would expect but the end_hour may not. If you specify the end_hour as 10, your time select will include 10:15, 10:30, 10:45. So the end_hour sets the last hour that the time select will include. Leave a comment if you want me to change this.
The code is hosted on github here: http://github.com/tamoyal/simple_time_select/tree/master
No TweetBacks yet. (Be the first to Tweet this post)
If you enjoyed this post, make sure you subscribe to my RSS feed!











4 Comments
Hey Tony – This is great thanks.
I’m having problems integrating it with my app because I need to write something like this:
time_form.time_entry ……
I tried to do this:
time_select time_form
but get a variable error.
Here is my full code. You can see I’ve resorted to using the ruby time_selects:
From: entry.id || "" %> To: entry.id || "" %>
Do you know of any fix? Thanks,
Dan
Whoops. Full code:
From: entry.id || “” %> To: entry.id || “” %>
Aghh I can’t post code. Here’s a link to a very similar partial:
http://agilerails.wordpress.com/2009/03/11/date_select-time_select-doesnt-work-with-auto_prefix-object/#comment-227
Hi Dan, please email your code to tonyamoyal@gmail.com. Or have you tried posting with the “pre” tags specifying the language as a “lang” attribute. I’ll test it now:
One Trackback
[...] the plugin: http://github.com/tamoyal/simple_time_select/tree/master Also be sure to check out the latest update. No TweetBacks yet. (Be the first to Tweet this post) Share and [...]