Class: Date

Inherits:
Object show all
Defined in:
lib/utopia/extensions/date.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/utopia/extensions/date.rb', line 29

def <=>(other)
	if other.class == Date
		old_compare(other)
	else
		if Time === other
			other = other.to_datetime
		end
		
	 	if DateTime === other
			result = old_compare(other.to_date)
			if result == 0 && other.day_fraction > 0
				-1
			else
				result
			end
		end
	end
end

#old_compareObject



27
# File 'lib/utopia/extensions/date.rb', line 27

alias_method :old_compare, :<=>