For Canada, the last day for tax-loss selling in 2021 is December 29. Stocks purchased or sold after this date will be settled in 2022, so any capital gains or losses will apply to the 2022 tax year. The system differs in the US, and based on information from the IRS, the last day for tax-loss selling this year is December 31.
-----------
Don't buy them back within 31 days.