Sha256: c9e3e49d8f7a3a2a6ed272bfa50a7ce784c40e9292688f3754f6b3db3b03189b

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

class Time
  public :to_date
  public :to_datetime
end

# THIS IS ALREADY IN RUBY, WHY WAS IT THOUGHT NOT TO BE?

=begin
unless (RUBY_VERSION[0,3] == '1.9')

  class Time

    # Convert a Time to a Date. Time is a superset of Date.
    # It is the year, month and day that are carried over.

    def to_date
      require 'date' # just in case
      jd = Date.__send__(:civil_to_jd, year, mon, mday, Date::ITALY)
      Date.new!(Date.__send__(:jd_to_ajd, jd, 0, 0), 0, Date::ITALY)
    end

  end

end
=end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facets-2.4.2 lib/core/facets/time/to_date.rb
facets-2.4.3 lib/core/facets/time/to_date.rb