As noted in the comment, since the problem is insolvable without having the dates in some form, I'll just assume you can create the date number vector associated with each observation from whatever format you do have.
Given that as variable dn, then to accumulate a summation over the months first must get a sequential month indicator over the length of the series.
Note the above will account for missing values simply by accumulating the values that are present for a given month; it will not indicate which are short months or the like...you'll have to do that by testing for spacing between the elements of ix that don't match the expected number of days for the month and year (altho it sounds as though you may already know which aren't complete so you can probably just convert that known info to the sequential month based on position(+)).
(+)NB: The above will not account for completely missing months excepting by there being a sequential month for each existing month in the date number vector. The accumlator as above treats every jump in month as an increment so if there are missing months in their entirety the accumlated series will shift down one in a numerical sense from where it would be based on a full 12-months/calendar year.