Capital Gains query - tax residency

If a non UK resident purchases a property but latterly becomes UK tax resident and then sells the property thereafter, are capital gains calculated on the date of purchase of the property or the date they became resident?

Thank you for your help