AppSales-Mobile
AppSales-Mobile copied to clipboard
2012 Fiscal calendar calculation is wrong for this year
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,
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];
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...
Thanks!
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];
Thanks folks. I pulled in the fix from your repo, Kerni. I can confirm the fix works for me.