#731 open
dsc68

<input for='time'> includes date select

Reported by dsc68 | May 26th, 2010 @ 05:56 PM | in Hobo 1.1

< input for='time' > displays selects for year, month and day as well as hour, minute and second.

The code shows that it is using the select_date helper instead of the select_time helper.

<def attrs='order' tag='input' for='time'>
  <% order = order.nil? ? [:year, :month, :day, :hour, :minute, :second] : comma_split(order).*.to_sym -%>
  <%= select_date(this || current_time, attributes.merge(:prefix => param_name_for_this, :order => order)) %>
</def>

Comments and changes to this ticket

  • Owen

    Owen May 29th, 2010 @ 12:51 AM

    • Milestone set to Hobo 1.1
    • State changed from “new” to “open”
    • Assigned user set to “Matt Jones”

    Quick win?

  • Matt Jones

    Matt Jones June 1st, 2010 @ 12:56 PM

    To be honest, what you're looking at here is an ActiveRecord issue and not a Hobo one - there's simply not a good match between the database type and the object type.

    For instance, MySQL's 'TIME' type is an interval (+/- 800ish days), but there's no corresponding Ruby type that really matches that behavior, so the adapter author punted to the identically named 'Time' class. The Postgres adapter further muddies the waters by mapping that 'Time' object to Postgres's 'time of day' type, with no direct handling by AR of the actual 'interval' type.

    As for the timezone issue you mention above, that's totally a Rails issue. You may want to double-check the timezone settings in your app, and file a ticket on the Rails LH if needed.

    If you're just wanting to store hours / minutes / seconds (a duration), I'd recommend you avoid all this craziness and just store it as an integer, possibly with a Hobo type that handles the formatting and parsing.

  • Domizio Demichelis

    Domizio Demichelis February 24th, 2011 @ 07:16 PM

    • Milestone order changed from “0” to “0”

    (from [a609abb821a8e5f5c58888f9a69d1f0f7cdfdf37]) refactory of tags for 'time', 'date' and 'datetime'

    • fxed input/view tag for 'time'
      • the time entered is the same time you get back from the db [#731]
      • the input-tag uses select_time
      • the view tag uses the canonical Time::DATE_FORMATS[:time]) and it is also overridable by just passing a strftime format as the format attribute
    • the input tags are now a smart wrapper around select_date and select_time and accept all their options and any html option
    • fixed the missing class attributes
    • fixed an hidden bug: the input-tag for time was never called because ActiveSupport::TimeWithZone.name is 'Time' as Time.name
    • updated doc https://github.com/tablatom/hobo/commit/a609abb821a8e5f5c58888f9a69...
  • Domizio Demichelis

    Domizio Demichelis March 11th, 2011 @ 01:55 PM

    (from [2d3b1425b02fbb9b182dcb2bad2d522760194146]) refactory of tags for 'time', 'date' and 'datetime'

    • fxed input/view tag for 'time'
      • the time entered is the same time you get back from the db [#731]
      • the input-tag uses select_time
      • the view tag uses the canonical Time::DATE_FORMATS[:time]) and it is also overridable by just passing a strftime format as the format attribute
    • the input tags are now a smart wrapper around select_date and select_time and accept all their options and any html option
    • fixed the missing class attributes
    • fixed an hidden bug: the input-tag for time was never called because ActiveSupport::TimeWithZone.name is 'Time' as Time.name
    • updated doc https://github.com/tablatom/hobo/commit/2d3b1425b02fbb9b182dcb2bad2...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Referenced by

Pages