Method: OpenHAB::CoreExt::Java::ZonedDateTime#-

Defined in:
lib/openhab/core_ext/java/zoned_date_time.rb

#-(other) ⇒ Duration, ZonedDateTime

Parameters:

Returns:

  • (Duration)

    If other responds to #to_zoned_date_time

  • (ZonedDateTime)

    If other is a TemporalAmount



46
47
48
49
50
51
52
53
54
# File 'lib/openhab/core_ext/java/zoned_date_time.rb', line 46

def -(other)
  if other.respond_to?(:to_zoned_date_time)
    java.time.Duration.between(other.to_zoned_date_time, self)
  elsif other.is_a?(Numeric)
    minus(other.seconds)
  else
    minus(other)
  end
end