Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

whats the use of these functions

edited November 2007 in Vanilla 1.0 Help
can someone explain me why these functions exist
they appear in Pear Date/Calc.php

function getFirstDayOfMonth($pn_month, $pn_year) { return 1; }
it takes in two variables does nothing to them and returns a constant, why can't you just use global FIRST_DAY_OF_MONTH = 1;
here is another one

function getFirstMonthOfYear($pn_year) { $ha_months = Date_Calc::getMonths($pn_year); return $ha_months[0]; }
you would assume that the getMonths() function prolly does something fancy to get the first month of a year which is '1' assuming sometimes in the past jan wasn't the first month of the year, hence the need for this. but nop. getMonths() returns an array
function getMonths($pn_year) { return array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); }

i think this can be used for lunar calendar, so you can change the getMonths() to your calendar need

Comments

  • Options
    got my answer from a friend
    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.
This discussion has been closed.