Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.
Help keep Vanilla free:function getFirstDayOfMonth($pn_month, $pn_year)
{
return 1;
}function getFirstMonthOfYear($pn_year)
{
$ha_months = Date_Calc::getMonths($pn_year);
return $ha_months[0];
} function getMonths($pn_year)
{
return array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
}The getMonths function makes sense... store in function/array to be returned as needed to use for whatever purpose... as opposed to storing the twelve months of the year in some table on the backend.
The getFirstMonthOfYear function utilized in the code might be for cases where the first month of the year is based on Fiscal rather than Calendar year and so the programmer decided to program this way and to shift which is considered first of month he would only have to modify the position of the month numbers in the getMonths array returning function
The getFirstDayOfMonth may have similar forethought as the getFirstMonthOfYear function in case someone decides first day of month will not always be 1. The fact that the rest of the code all over the place will only reference the function means that if there is ever any change like it has to be first business day of the month etc... then that function can be modified and rest of code doesn't have to be touched.
Basically whomever wrote those functions is going for modularity and planning for possible changes in the specifications which may seem stupid but can happen and then the original programmer that is being ridiculed for being weird in his programming can bill the client for bunch of hrs/days and do minimal (like 5-10 minutes) of work to adjust his code.
1 to 2 of 2