Sha256: e6509bb142ec4fb2c3869a8dae74446ac18f2e980cf6f543fd37d6879822cf5d

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 Date
  def localize(locale = TwitterCldr.get_locale, options = {})
    TwitterCldr::LocalizedDate.new(self, locale, options)
  end
end

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

    protected

    def formatter_const
      TwitterCldr::Formatters::DateFormatter
    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/date.rb
twitter_cldr-1.6.2 lib/twitter_cldr/core_ext/calendars/date.rb
twitter_cldr-1.6.1 lib/twitter_cldr/core_ext/calendars/date.rb
twitter_cldr-1.6.0 lib/twitter_cldr/core_ext/calendars/date.rb
twitter_cldr-1.5.0 lib/twitter_cldr/core_ext/calendars/date.rb
twitter_cldr-1.4.1 lib/twitter_cldr/core_ext/calendars/date.rb
twitter_cldr-1.4.0 lib/twitter_cldr/core_ext/calendars/date.rb
twitter_cldr-1.3.6 lib/twitter_cldr/core_ext/calendars/date.rb
twitter_cldr-1.3.0 lib/twitter_cldr/core_ext/calendars/date.rb
twitter_cldr-1.2.0 lib/twitter_cldr/core_ext/calendars/date.rb