Skip to content

Date, time & datetime #142

Closed
kuraga opened this Issue Mar 14, 2012 · 1 comment

2 participants

@kuraga
kuraga commented Mar 14, 2012

Now the type of object for localization is determined by line:

# lib/i18n/backend/base.rb, line 53
type = object.respond_to?(:sec) ? 'time' : 'date'

But why don't you determine DateTime? I suggest something like:

type = case object.class
  when Time
    'time'
  when Date
    'date'
  when DateTime
    'datetime'
  else
    raise ArgumentError
end

It's helpfull very much - we haven't think about the DateTime type!

@knapo
Collaborator
knapo commented Nov 25, 2012

I aggree that that condition is not the best way of handling it, but in my opinion Time and DateTime formats (https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en.yml#L194) should be the same, as from UI point of user there is no difference between Time and DateTime . Did you meet any case when you needed different localizing for DateTime and Time ?

@kuraga kuraga closed this Aug 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.