Class: Date

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

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/utopia/extensions/date.rb', line 13

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



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

alias_method :old_compare, :<=>