this is clearly wrong.. it shouldn't use the average.. it should detect how many days from startDay until the end of the month (1st day of next month). If the `baseTotalDays > startDay` it should consider that next month will be at `end.setDate(startDay)`...