Year in which Expenses should be deducted on preparing for sale of rental property

I incurred expenses to fix up a rental property in 2021 but the sale happened in Jan 2022. The rental was not occupied since July 2021 because it was being prepared for sale. 

Question: should I be deducting the expenses in 2021 taxes or moved to 2022 when it actually got sold? Does it make a difference?

Thanks in advance.