Class: MOCO::Helpers

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

Class Method Summary collapse

Class Method Details

.decimal_hours_to_civil(decimal_hours) ⇒ Object



5
6
7
8
9
10
# File 'lib/moco/helpers.rb', line 5

def self.decimal_hours_to_civil(decimal_hours)
  hours = decimal_hours.floor
  fractional_hours = decimal_hours - hours
  minutes = (fractional_hours * 60).round
  "#{hours}:#{format("%02d", minutes)}"
end