Project

human-date

0.0
No commit activity in last 3 years
No release in over 3 years
Human readable date differences
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

human-date

Installation:

gem install human-date

Usage:

require 'human-date'

translator = HumanDate::DateTranslator.new
date1 = DateTime.parse "2011-10-23T00:00:00"
date2 = DateTime.parse "2012-12-25T02:05:10"

translator.translate(date1, date2)
#=> 1 year, 2 months, 4 days, 2 hours, 5 minutes and 10 seconds

translator.translate(date2, date1)
#=> 1 year, 2 months, 4 days, 2 hours, 5 minutes and 10 seconds ago

translator.parts = [:year, :month, :day]
translator.translate(date1, date2)
#=> 1 year, 2 months and 4 days