Skip to content
This repository

Date, time & datetime #142

Closed
kuraga opened this Issue · 1 comment

2 participants

Kurakin Alexander Krzysztof Knapik
Kurakin Alexander

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!

Krzysztof Knapik
Collaborator

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 ?

Kurakin Alexander kuraga closed this
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.