This module provides a method for calculate the duration time from a date
like reg_date, which is usually used for statistics.
Usage:
# Assume that today is 2013-07-07
require 'duration_time'
reg_time = Time.new(2011,8,2,0,0,0, "+08:00")
# You can use reg_time = Date.parse("2011-08-02") if you have included
# gem active_support!
duration_time( reg_time )
# => {
# :years=>[2011, 2012, 2013],
# :months=>["2011-08", "2011-09", "2011-10", "2011-11", "2011-12",
# "2012-01", "2012-02", "2012-03", "2012-04", "2012-05", "2012-06",
# "2012-07", "2012-08", "2012-09", "2012-10", "2012-11", "2012-12",
# "2013-01", "2013-02", "2013-03", "2013-04", "2013-05", "2013-06"],
# :quarters=>["2011-09", "2011-12", "2012-03", "2012-06", "2012-09",
# "2012-12", "2013-03", "2013-06"]
# }
And you can specify default parameter `include_this_month_of_this_year = true`
if you want to include this month of this year. Default value is `false`.
Project
duration_time
This module provides a method for calculate the duration time from a date \nlike reg_date, which is usually used for statistics.\n\nUsage:\n\n # Assume that today is 2013-07-07\n require 'duration_time' \n reg_time = Time.new(2011,8,2,0,0,0, "+08:00")\n # You can use reg_time = Date.parse("2011-08-02") if you have included\n # gem active_support!\n duration_time( reg_time ) \n # => {\n # :years=>[2011, 2012, 2013], \n # :months=>["2011-08", "2011-09", "2011-10", "2011-11", "2011-12", \n # "2012-01", "2012-02", "2012-03", "2012-04", "2012-05", "2012-06", \n # "2012-07", "2012-08", "2012-09", "2012-10", "2012-11", "2012-12", \n # "2013-01", "2013-02", "2013-03", "2013-04", "2013-05", "2013-06"], \n # :quarters=>["2011-09", "2011-12", "2012-03", "2012-06", "2012-09", \n # "2012-12", "2013-03", "2013-06"]\n # }\n\nAnd you can specify default parameter `include_this_month_of_this_year = true`\nif you want to include this month of this year. Default value is `false`.\n
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Development
Dependencies
Project Readme