Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

datetime_select to accept :ampm option

#1004

I'd like to propose the development of a patch to core that adds the capability of the datetime_select to render a 12-hour selectlist for the hour, and an am/pm selectlist.

Previous plugin/module solutions to this are old, I couldn't find anything relevant on github, and this just seems (to me) like it should belong in core.

I belive this this will also require changes to AR.

Patch to come, unless this ticket gets nixed.

Reported by Yong Bakos · September 9th, 2008 @ 06:28 PM

State: stale
Milestone: 3.x
Assigned to: Geoff Buesing Geoff Buesing
Importance: none

Activity

  1. Geoff Buesing
    Geoff Buesing

    Seems like a common enough need; I'd like to see it in core.

    September 15th, 2008 @ 09:06 PM

  2. Yong Bakos
    Yong Bakos
    • Tag changed from activerecord, enhancement, helper, patch to activerecord, enhancement, helper, patch

    Glad to see your support. I hope to have this ready by the end of the month (that thing called 'work' always gets in the way).

    September 16th, 2008 @ 04:02 PM

  3. Yong Bakos
    Yong Bakos

    Just an update. No progress on this patch yet.

    October 13th, 2008 @ 08:24 PM

  4. Jeff
    Jeff

    I would love to see this implemented.

    October 16th, 2008 @ 02:20 PM

  5. Jeff
    Jeff

    incidentally, http://code.google.com/p/rails-t... seems to work fine with 2.1. Haven't tested it against edge

    October 17th, 2008 @ 07:59 PM

  6. Pratik
    Pratik
    • State changed from new to incomplete

    January 18th, 2009 @ 07:08 AM

  7. Pratik
    Pratik
    • Assigned user set to Geoff Buesing

    January 18th, 2009 @ 07:08 AM

  8. Eric Mill
    Eric Mill

    I hope this doesn't fall off a cliff; 12-hour time is the way of things in the West, its lack is glaring.

    June 11th, 2009 @ 08:35 PM

  9. Daniel Tsadok
  10. Elliot Winkler
    Elliot Winkler

    The rails-twelve-hour-time plugin linked to above also works in 2.3. You could probably start with that.

    July 1st, 2009 @ 10:49 PM

  11. Daniel Tsadok
    Daniel Tsadok

    True but it seems like it belongs in core, since it's such a common use case. Also, if you set prompt => true, Rails 2.3 gives a translation error for the prompt for AM/PM.

    July 2nd, 2009 @ 04:11 AM

  12. Yong Bakos
    Yong Bakos

    I am now (finally) actively working on this. Please stay tuned.

    July 26th, 2009 @ 07:04 PM

  13. Geoff Buesing
  14. Yong Bakos
    Yong Bakos

    Sorry, but no. (professional obligations are in my way)

    January 28th, 2010 @ 06:33 PM

  15. Chad Jolly
    Chad Jolly

    +1

    I did a demo of an app today and the one 24hr time select was the glaring sticking point with the users. Kinda funny. As a quick fix I used some jQuery. Here's the snippet if anyone is interested:
    http://gist.github.com/368952

    Hi Yong.

    April 16th, 2010 @ 10:42 PM

  16. Yuval
    Yuval

    +1 I'd like to see this implemented in core as well. I think there's a large enough user base that needs to user a 12-hour format (i.e. doesn't intuitively understand military time) that it should exists as an option under datetime_select.

    April 17th, 2010 @ 05:40 AM

  17. Neeraj Singh
    Neeraj Singh

    I started working on patch for this issue. However because of inconsistencies between select and select methods I was not able to make a good patch. I opened another ticket #4432 datetime_select and select_datetime inconsistent for various options .

    Now that #4432 datetime_select and select_datetime inconsistent for various options is resolved, I will take another shot at this one.

    April 29th, 2010 @ 12:51 PM

  18. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  19. Trevor Turk
    Trevor Turk
    • Importance changed from to

    Just a quick thanks to Chad Jolly for the jQuery workaround. I'll keep an eye on this ticked in case anything else comes around, but I'm happy enough for now. Thanks :)

    July 1st, 2010 @ 07:09 PM

  20. Matt Todd
    Matt Todd

    Here's a patch for multiparameter_attributes to support a 7th attribute with am/pm.

    WIP. Needs accompanying changes to the datetime/time select helpers.

    Why does 12am/pm have to be lame? :(

    November 16th, 2010 @ 10:17 AM

  21. rails
    rails
    • State changed from incomplete to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 17th, 2011 @ 12:00 AM

  22. rails
    rails
    • State changed from open to stale

    February 17th, 2011 @ 12:00 AM

  23. Aditya Sanghi
    Aditya Sanghi

    If someone is still keen, I built this functionality and sent a pull request on Github. Please see https://github.com/rails/rails/pull/343

    April 29th, 2011 @ 06:01 AM