AppSales-Mobile icon indicating copy to clipboard operation
AppSales-Mobile copied to clipboard

2012 Fiscal calendar calculation is wrong for this year

Open EnlightenedMike opened this issue 13 years ago • 5 comments

Hello, the ITC Apples 2012 fiscal year calendar has 5 weeks in December, not 4. This seems to be an exception.

Anyone got an idea other the a "hack" in the AppleFiscalCalendar.m looking for the period exception.

October and December have 5 weeks,

EnlightenedMike avatar Jan 01 '12 00:01 EnlightenedMike

Exceptions are "hacks" :)

I did this in line 37:

NSDate *nextDate;
if (period == 50)
    nextDate = [calendar dateByAddingComponents:components5Weeks toDate:currentDate options:0];
else
    nextDate = [calendar dateByAddingComponents:((period % 3 == 0) ? components5Weeks : components4Weeks) toDate:currentDate options:0];

DerAndereAndi avatar Jan 01 '12 01:01 DerAndereAndi

Yes, thanks... Same here, Looks like every year that has 29 days in February has a 5 week December.

Thanks Again and Happy New Year...

EnlightenedMike avatar Jan 01 '12 01:01 EnlightenedMike

Thanks!

finder39 avatar Jan 16 '12 20:01 finder39

So, a more generalized approach would be to use following for line 37 in AppleFiscalCalendar.m:

NSDate *nextDate = [calendar dateByAddingComponents:((period % 3 == 0) || (period % 50 == 0) ? 
    components5Weeks : components4Weeks) toDate:currentDate options:0];

kashifhisam avatar Jan 18 '12 06:01 kashifhisam

Thanks folks. I pulled in the fix from your repo, Kerni. I can confirm the fix works for me.

pilotmoon avatar Feb 22 '12 20:02 pilotmoon