TimeHumanizer
Formats seconds to readable time format i.e. 8h05m and vice versa. See examples below.
Installation
Add this line to your application's Gemfile:
gem 'time_humanizer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install time_humanizer
Usage
TimeHumanizer.to_seconds(nil)
TimeHumanizer.to_seconds('0')
TimeHumanizer.to_seconds('1')
TimeHumanizer.to_seconds('1h')
TimeHumanizer.to_seconds('1h30m')
TimeHumanizer.to_seconds('2m')
TimeHumanizer.to_seconds('1h5m')
TimeHumanizer.to_seconds('1h06m')
TimeHumanizer.to_seconds('1h0m')
TimeHumanizer.to_seconds('')
TimeHumanizer.to_seconds(' ')
TimeHumanizer.to_seconds('x')
TimeHumanizer.to_seconds(' x')
TimeHumanizer.to_seconds('0f')
TimeHumanizer.to_humanized_time(nil)
TimeHumanizer.to_humanized_time(0)
TimeHumanizer.to_humanized_time(3600)
TimeHumanizer.to_humanized_time(5400)
TimeHumanizer.to_humanized_time(120)
TimeHumanizer.to_humanized_time(3900)
TimeHumanizer.to_humanized_time(3960)
TimeHumanizer.to_humanized_time('0')
TimeHumanizer.to_humanized_time('3600')
TimeHumanizer.to_humanized_time('5400')
TimeHumanizer.to_humanized_time('120')
TimeHumanizer.to_humanized_time('3900')
TimeHumanizer.to_humanized_time('3960')
TimeHumanizer.to_humanized_time(''
TimeHumanizer.to_humanized_time(' ')
TimeHumanizer.to_humanized_time('x')
TimeHumanizer.to_humanized_time(' x')
TimeHumanizer.to_humanized_time('0f')
Contributing
- Fork it ( https://github.com/b-wojtowicz/time_humanizer/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request