Class: A14z6chElapsedDays::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/a14z6ch_elapsed_days.rb

Class Method Summary collapse

Class Method Details

.calc(date) ⇒ Object

calculating method

Parameters:

  • from

    date



20
21
22
23
24
25
26
27
# File 'lib/a14z6ch_elapsed_days.rb', line 20

def calc(date)
  begin
    elapsed_seconds = Time.now - Time.parse(date)
	  (elapsed_seconds / 60 / 60 / 24).to_i
  rescue ArgumentError => e
	  puts "given date is not valid.".colorize(:light_blue)
	end
end