asanghi / fiscali

Fiscal Year Date Functions

Home Page:http://asanghi.github.com/fiscali

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

financial_year flexibility

chiperific opened this issue · comments

commented

Not really a bug, but a feature request. GREAT gem, by the way. Saved me hours!

Fiscal years are often named future-tense. For example, July 2012 - June 2013 is referred to as FY 2013. Your system returns FY2012 here:

def financial_year self.month < start_month ? self.year - 1 : self.year end

I changed it to:
`def financial_year
self.month < start_month ? self.year : self.year + 1
end``

It might be nice to be able to set that as a default option.

Thanks again for a good, clean gem.

Cool! Sounds like a great idea. Perhaps you want to send a pull request so that it can be made configurable? Introduce a configuration class variable called use_forward_year

def financial_year
  if self.class.use_forward_year
    self.month < start_month ? self.year : self.year + 1
  else
    self.month < start_month ? self.year - 1 : self.year
  end
end