Marriages,+Length+of

This script answers the question, "How long have marriages lasted?". For each Marriage and corresponding Annulment or Divorce event for a couple, it extracts the year of the events and also gets the year of the death of the earlier of the two to have died. It then calculates the length in time between the year of the marriage event and the earliest of the years of the Annulment, Divorce and Death events as the length of the marriage. In the absence of a year for any of these terminal events, it uses the current year from system time. Results are limited to 99 years max. The second last row in the example is the special case of a couple that divorces and remarries each other; the Length of the second marriage is correct but the Divorced year throws a curve visually. It could be suppressed with a some more coding but is a rare state.

The Died year comes from the Person's DeathYear field in the NameTable, not directly from the Death or Burial facts, so it is advisable to use File > Database Tools > Rebuild Indexes before running the script to ensure that the DeathYear is sync'd to the latest edits or additions of Death/Burial events.

When there are multiple events of a given type, this script probably extracts the year of the first entered; it could be enhanced to select the Primary.