Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Converts times into "fuzzy" output

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 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.