Class: ReeDatetime::SecondsDiff

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_datetime/package/ree_datetime/functions/seconds_diff.rb

Instance Method Summary collapse

Instance Method Details

#call(start_time, end_time, **opts) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
# File 'lib/ree_lib/packages/ree_datetime/package/ree_datetime/functions/seconds_diff.rb', line 18

def call(start_time, end_time, **opts)
  s_delta = end_time.to_time.to_i - start_time.to_time.to_i
  raise ArgumentError, "start_time bigger than end_time" if s_delta < 0
  s_delta
end