asanghi/fiscali — pull request #8 by reed (2014-12-17 22:45:05+00:00)
Title: A few minor improvements

Thanks for writing this gem. It's been really useful. I ran into a couple little issues that led to the changes in this pull request. Here's a rundown of what I did:

* I found that the `end_of_financial_q*` and `end_of_financial_h*` methods were returning the wrong dates in some cases. In particular, it would happen when the last month of the financial year only had 30 days in it.

```
Date.fiscal_zone = :us
Date.new(2009,1,1).end_of_financial_q1
=> Tue, 30 Dec 2008
```

* I improved the accuracy of the `beginning_of_` and `end_of_` methods when used with `Time` or `DateTime` instances. They now set the timestamp to the beginning or end of the day (depending on which method you're using). This matches the behavior of similar methods in ActiveSupport, such as `end_of_month`.

* I added a parameter to the `beginning_of_financial_quarter` method, allowing you to specify which quarter of the instance's financial year you want the beginning of. If no argument is passed in, it defaults to the original behavior of using the current quarter for the instance. Adding the parameter also allowed for the `beginning_of_financial_q*` methods to be dynamically defined.

* I added an `end_of_financial_quarter` method to match the `beginning_of_financial_quarter` method.

* The documentation on the README for the `financial_quarter` method was incorrect, as it actually includes the year in the output.