MDL-41792 core_calendar: fixed issues when using multiple calendar types

1) No longer assume that the end of the current month in Gregorian will be
the end of the month for the calendar type being used.
2) Need to take into account the hours and minutes a calendar system may vary
in order to generate the previous and last month.