PeriodDates

This gems adds some instance functions to Date and DateTime in order to get date ranges for a certain period vairable given a date.

You cannot chain after this instance functions as this returns an array of to dates or dateTime objects.

# Functions:

  • last_period_dates(period)

  • next_period_dates(period)

  • current_period_dates(period)

  • offset_period_dates(period,offset)

Period is optional and by default is ‘monthly’ Offset is optional and by default is 0

# Periods available:

  • monthly ( 1 month )

  • quarterly ( 3 months )

  • biannualy ( 6 months )

  • semestral ( 6 months )

Only this periods can be specifyed, if other period is given a exception will raise.

# Use

“‘ date = Date.new(2015,3,1) dates = date.current_period_dates(’biannually’)

> dates = 2015-01-01 and dates = 2015-06-01

“‘

# To-Do

  • Standarize interface