fix recalculating date at the end of the month