The first year or two almost always favours renting, since legal fees of $800 to $1,500 land upfront and a mortgage payment in year one is mostly interest, building very little equity toward the home.
The turning point comes when rising rent overtakes a fixed mortgage payment and enough principal has been paid down that selling would clear more than it cost to buy. In a market with 1.63 months of supply, that crossover tends to land closer to three years than five, because prices have not run away from renters the way they have in larger cities.
The number that matters is your own numbers, not a rule of thumb, since your rate, your down payment and your plans for how long you stay all move the year the crossover actually happens. Get your hand-reviewed valuation from Joel Dyck.