Capital Gains to two states while livng in the two states

I sold a property in January of 2022 and need to pay capital gains.  I was living in California when I sold the property but the property was in Utah.  In August I moved to Utah so I lived in California for 7 months and Utah for 5 months.   Does my time spent living in each state affect the capital gains amounts?