Sha256: c0586c59567dfa7225ea0492336a901a5eae81117a2130b98e862cd0f3ef1eeb

Contents?: true

Size: 659 Bytes

Versions: 10

Compression:

Stored size: 659 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

class Time
  def localize(locale = TwitterCldr.get_locale, options = {})
    TwitterCldr::LocalizedTime.new(self, locale, options)
  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, :calendar_type => @calendar_type)
    end

    protected

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
twitter_cldr-1.7.0 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.6.2 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.6.1 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.6.0 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.5.0 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.4.1 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.4.0 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.3.6 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.3.0 lib/twitter_cldr/core_ext/calendars/time.rb
twitter_cldr-1.2.0 lib/twitter_cldr/core_ext/calendars/time.rb