0.0
No commit activity in last 3 years
No release in over 3 years
A gem tells you what financial year is it now, and also the date range of it
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.15
~> 10.0
~> 3.0
 Project Readme

FinancialYear

A gem tells you what financial year is it now, and also the date range of it

How to use it

PUT this in your Gemfile
gem 'financial_year', '~> 0.1.0'
  klass = FinancialYear::FinancialYear.config(
    start_month = 4,
    start_day = 1,
    end_month = 3,
    end_day = 31
  )

  financial_year = klass.for_year(2017)
  financial_year.financial_year_range
  # expect(instance.financial_year_range).to eq Date.new(2016, 4, 1)..Date.new(2017, 3, 31)

  financial_year.ytd_range
  # expect(instance.ytd_range).to eq Date.new(2017, 4, 1)..Date.today


  # Real life example
  today = Date.today

  start_last_year = today.month >= FinancialYear.start_month ? today.year - 1 : today.year - 2
  # Last financial year
  last_year = FinancialYear.for_year(start_last_year).financial_year_range

  # This on going financial year
  current_year_ytd = FinancialYear.for_year(start_last_year + 1).ytd_range