Project

fuzzytime

0.0
No commit activity in last 3 years
No release in over 3 years
Sample output: 2:30AM => half past 2 7:50AM => 10 til 8 12:00PM => noon 5:15PM => quarter past 5 9:00PM => 9 o'clock 10:17PM => 17 past 10 12:00AM => midnight
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0
>= 0
 Project Readme

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"