Skip to content

Commit

Permalink
DateTimeType spec fix
Browse files Browse the repository at this point in the history
Signed-off-by: Jimmy Tanagra <[email protected]>
  • Loading branch information
jimtng committed Sep 16, 2024
1 parent d8f0e9e commit d770268
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/openhab/core/types/date_time_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def <=>(other)
logger.trace { "(#{self.class}) #{self} <=> #{other} (#{other.class})" }
if other.is_a?(self.class)
zoned_date_time <=> other.zoned_date_time
elsif other.respond_to?(:to_zoned_date_time)
zoned_date_time <=> other.to_zoned_date_time
elsif other.respond_to?(:to_time)
to_time <=> other.to_time
elsif other.respond_to?(:coerce)
Expand Down
1 change: 1 addition & 0 deletions spec/openhab/core/types/date_time_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
zone_id = ZoneId.of("+1000")
date_time_type = DateTimeType.parse("3:30+1000").to_zone(zone_id)
date_time = ZonedDateTime.now.with(LocalTime.parse("3:30")).with_zone_same_local(zone_id)
logger.trace { "date_time_type: #{date_time_type}, date_time: #{date_time}" }
expect(date_time_type).to eq date_time
end
end
Expand Down

0 comments on commit d770268

Please sign in to comment.