calculate start day of the month correctly