Sha256: efe4b56e62833d533a1da20970ed27e023dbffbef8038b3a2937af904ed900a2

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

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.0.0 lib/ext/calendars/date.rb