Sha256: f3e1ccbe489fe613b21770b35698b4aa4d5cc52acaeea35210e65cb44a5a6b2d

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

class Time
  def localize(locale = TwitterCldr.get_locale)
    TwitterCldr::LocalizedTime.new(self, locale)
  end
end

module TwitterCldr
  class LocalizedTime < LocalizedDateTime
    def to_datetime(date)
      date_obj = date.is_a?(LocalizedDate) ? date.base_obj : date
      LocalizedDateTime.new(DateTime.parse("#{date_obj.strftime("%Y-%m-%d")}T#{@base_obj.strftime("%H:%M:%S%z")}"), @locale)
    end

    protected

    def formatter_const
      TwitterCldr::Formatters::TimeFormatter
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-1.0.0 lib/ext/calendars/time.rb