Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Converts times into "fuzzy" output
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
Gemfile
LICENSE
README.md
Rakefile
fuzzytime.gemspec

README.md

This simple gem outputs time in a "fuzzy" manner.

Note: this is my first gem so please do tell if you find anything wrong with it!

It takes the Time class as input or defaults to the current local time if no time is provided.

Example usage:

require 'fuzzytime'

t = Time.local(2012,1,1,0,0)
Fuzzytime.fuzzy_time(t) => "midnight"

t = Time.local(2012,3,17,4,20)
Fuzzytime.fuzzy_time(t) => "20 past 4"

t = Time.local(2012,3,17,9,45)
Fuzzytime.fuzzy_time(t) => "quarter til 10"

t = Time.local(2012,1,1,12,0)
Fuzzytime.fuzzy_time(t) => "noon"

t = Time.local(2012,3,17,17,15)
Fuzzytime.fuzzy_time(t) => "quarter past 5"
Something went wrong with that request. Please try again.