Skip to content
Browse files

adding financial_year_start method

  • Loading branch information...
1 parent cdcce03 commit ae1f7fd009ac731ae99ed76bcba753bd25bdd8e7 asanghi committed Jul 25, 2009
Showing with 8 additions and 0 deletions.
  1. +4 −0 lib/rising_sun/fiscali.rb
  2. +4 −0 test/fiscali_test.rb
View
4 lib/rising_sun/fiscali.rb
@@ -29,6 +29,10 @@ def fy_start_month=(month)
write_inheritable_attribute(:zone, nil)
write_inheritable_attribute(:start_month,month)
end
+
+ def financial_year_start(year=Date.today.year)
+ Date.new(year,fy_start_month,1)
+ end
end
module InstanceMethods
View
4 test/fiscali_test.rb
@@ -9,6 +9,10 @@ class FiscaliTest < ActiveSupport::TestCase
assert_equal(Date.fy_start_month,2)
Date.fiscal_zone = :india
+
+ d = Date.financial_year_start(2009)
+ assert_equal(d,Date.new(2009,4,1),'Financial Year start not correct')
+
d = Date.new(2009,1,1)
assert_equal(d.financial_year,2008,'Financial Year is not correct')
assert_equal(d.beginning_of_financial_year,Date.new(2008,4,1),'Beginning of FY is not correct')

0 comments on commit ae1f7fd

Please sign in to comment.
Something went wrong with that request. Please try again.