Sha256: 2e6b504879921234d2cc419acc200a1444eebcbcffcfa2633aa18f58582dec9f

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 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)
    TwitterCldr::LocalizedDate.new(self, locale)
  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)
    end

    protected

    def formatter_const
      TwitterCldr::Formatters::DateFormatter
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-1.1.0 lib/ext/calendars/date.rb