Skip to content

Commit 148f849

Browse files
committed
Merge pull request rails#4524 from nashby/datetime-18-code
remove ruby 1.8 related code
2 parents a3b3643 + f54b846 commit 148f849

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

activesupport/lib/active_support/core_ext/date_time/conversions.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,32 +58,17 @@ def readable_inspect
5858
alias_method :default_inspect, :inspect
5959
alias_method :inspect, :readable_inspect
6060

61-
# Converts self to a Ruby Date object; time portion is discarded.
62-
def to_date
63-
::Date.new(year, month, day)
64-
end unless instance_methods(false).include?(:to_date)
65-
6661
# Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class.
6762
# If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time.
6863
def to_time
6964
self.offset == 0 ? ::Time.utc_time(year, month, day, hour, min, sec, sec_fraction * 1000000) : self
7065
end
7166

72-
# To be able to keep Times, Dates and DateTimes interchangeable on conversions.
73-
def to_datetime
74-
self
75-
end unless instance_methods(false).include?(:to_datetime)
76-
7767
def self.civil_from_format(utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0)
7868
offset = utc_or_local.to_sym == :local ? local_offset : 0
7969
civil(year, month, day, hour, min, sec, offset)
8070
end
8171

82-
# Converts datetime to an appropriate format for use in XML.
83-
def xmlschema
84-
strftime("%Y-%m-%dT%H:%M:%S%Z")
85-
end unless instance_methods(false).include?(:xmlschema)
86-
8772
# Converts self to a floating-point number of seconds since the Unix epoch.
8873
def to_f
8974
seconds_since_unix_epoch.to_f

0 commit comments

Comments
 (0)