We bought our boat two years before we left for SoPac. It was a do it yourself Westsail 32 with the motor installed. Took us a year to mostly build out the interior and launch the boat working full time. Living aboard during construction pretty much allowed us to test out storage and layout so it pretty much fit us to a tee from the day it went in the water.
Once we hit the water progress slowed way way down. It was another six months before we were ready to sail the boat on a regular basis. We spent another six months cruising SoCal hopping from marina/anchorage to marina/anchorage from Santa Barbara to San Diego and back. That gave us a chance to test out a lot of rigging iand sail ideas and change or discard some of them and add others. That was a very important time as it gave a chance to really get to know the boat and use it as we would when cruising. There is a difference living tied to a dock and out sailing or anchored.
So I'd plan on buying a boat at least as soon as you can move aboard full time and take short cruises along the coast. Buying it before that is as soon as it fits your ability to afford it and know what you want.