calculate end of year properly