Simple Time Select for Ruby On Rails Just Got Simpler

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)
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis

If you enjoyed this post, make sure you subscribe to my RSS feed!

This entry was posted in Software and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

4 Comments

  1. Dan
    Posted November 13, 2009 at 3:14 pm | Permalink

    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

  2. Dan
    Posted November 13, 2009 at 3:15 pm | Permalink

    Whoops. Full code:

    From: entry.id || “” %> To: entry.id || “” %>

  3. Dan
    Posted November 13, 2009 at 3:16 pm | Permalink
  4. Posted November 13, 2009 at 4:27 pm | Permalink

    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:

    puts "Hello World"

One Trackback

  1. [...] 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 [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">