For top surgery, my surgeon wanted me to halve my dose a month in advance and then stop outright at two weeks pre-op. I didn't think I could comfortably go that long, so I instead halved my dose at two weeks pre-op and then stopped a week before. I don't think it had any negative effects for me. My healing was pretty quick and I had no bleeding issues, which is the concern with testosterone.
I did not have to stop at all for my hysterectomy. In fact they encouraged staying on so that I would have hormones in my body immediately post op.
For bottom surgery I was told to stop three weeks in advance. At the three week mark, I gave myself a double dose (I inject weekly so this is what my dose would be for biweekly shots) and stopped after that. I have had some minor bleeding issues, but I think that is mostly due to the vaginectomy being a bloody ordeal in itself and nothing to do with testosterone.