When either the husband or wife claims or pretends that the marriage is void or voidable, the other spouse may bring an action to have the marriage declared valid. The court may determine if the marriage is void from the beginning or from the time of the judgment or that it is valid.