This was in the USA, where the law states that landlords and their hired contractors may enter during "reasonable hours" for "improvements."
Probably rendering the apartment inhabitable for hours every day is not legal, and I could have sued for some compensation, but living there had gotten so miserable with the construction noise and random water shutoffs that I just wanted out.
The law varies by state. The states I'm familiar with have a tenants' right to "peaceable enjoyment" of their rented premises.
The new owners were trying to smoke you out. They might have been able to evict you on the basis of their desire to do significant work on the apartment (again, varies by state), but they probably figured it'd be cheaper to just make you miserable. Maybe that's legal in your state.
Probably rendering the apartment inhabitable for hours every day is not legal, and I could have sued for some compensation, but living there had gotten so miserable with the construction noise and random water shutoffs that I just wanted out.