In the event of a divorce, the court needs to know the value of the property at the date of marriage, and at the date when each contribution is made, because the contribution affects the start date of appreciation or depreciation. Usually, if the property is costly, then a forensic
accountant is required to testify to the dates and valuation amounts.
The formula is called "Moore-Marsden," and it's actually pretty simple, when there is only one contribution of separate or community property. But, when there are multiple contributions at different times, things get very ugly, very fast. Usually, with a typical divorce, the cost of the forensic accountant and related testimony
and reports is more costly than the difference between what the spouses believe they should receive at divorce. Consequently, most cases settle by agreement, usually with very little actual math being done. Otherwise, there's no alternative but to spend about $10,000 on accounting and litigation
to resolve the question decisively.
Hope this helps.