Skip to content
This repository

Date, time & datetime #142

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
  when Date
  when DateTime
    raise ArgumentError

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

Krzysztof Knapik

I aggree that that condition is not the best way of handling it, but in my opinion Time and DateTime formats ( 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.