Module: Dsu::Support::TimeComparable

Included in:
Models::EntryGroup
Defined in:
lib/dsu/support/time_comparable.rb

Constant Summary collapse

TIME_COMPARABLE_FORMAT_SPECIFIER =
'%Y%m%d'

Class Method Summary collapse

Class Method Details

.time_equal?(other_time:) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/dsu/support/time_comparable.rb', line 10

def time_equal?(other_time:)
  time_equal_compare_string_for(time: time) == time_equal_compare_string_for(time: other_time)
end

.time_equal_compare_string_for(time:) ⇒ Object



14
15
16
17
18
# File 'lib/dsu/support/time_comparable.rb', line 14

def time_equal_compare_string_for(time:)
  time = time.in_time_zone

  time.strftime(TIME_COMPARABLE_FORMAT_SPECIFIER)
end