+<code></code>To ensure that an updated date value is consistent, i.e. all
+its struct fields are consistent with each other, the following function
+can be used:<br>
+<blockquote><code>int <b>gedcom_normalize_date</b> (Date_input compute_from, struct date_value* value);<br></code></blockquote>
+
+<code></code>The <code>compute_from</code> parameter determines which fields
+will be taken as input to compute the other fields. The following table
+gives an overview of the input and output parameters (the calendar type <code>cal</code> is always an input parameter, and should not be <code>CAL_UNKNOWN</code>):<br>
+<br>
+<table cellpadding="2" cellspacing="2" border="1" width="100%">
+ <tbody>
+ <tr>
+ <td valign="top" align="center"><b>compute_from</b><br>
+ </td>
+ <td valign="top" align="center"><b>input parameters</b><br>
+ </td>
+ <td valign="top" align="center"><b>output parameters</b><br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top"><code>DI_FROM_STRINGS</code><br>
+ </td>
+ <td valign="top"><code>day_str, month_str, year_str</code><br>
+ </td>
+ <td valign="top"><code>day, month, year, year_type<br>
+type, sdn1, sdn2</code><br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top"><code>DI_FROM_NUMBERS</code><br>
+ </td>
+ <td valign="top"><code>day, month, year, year_type</code><br>
+ </td>
+ <td valign="top"><code>day_str, month_str, year_str<br>
+
+type, sdn1, sdn2</code><br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top"><code>DI_FROM_SDN</code><br>
+ </td>
+ <td valign="top"><code>type, sdn1, sdn2</code><br>
+ </td>
+ <td valign="top"><code>day, month, year<br>
+day_str, month_str, year_str</code><br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<br>
+If the type in the date value is <code>DV_PHRASE</code>, no conversions take
+place, otherwise one or both of the date structs are processed according
+to the table above, depending on the type. The function returns 0 in case of success, non-zero in case of an error.<br>
+<br>
+This function could also be used to convert a date from one calendar to another,
+because the serial day number is calendar independent (error handling is
+ignored in this example):<br>
+<blockquote><code>struct date_value* dv = gedcom_new_date_value(NULL);<br>
+dv->date1.cal = CAL_GREGORIAN;<br>
+dv->date1.day = 4</code>;<br>
+ <code>dv->date1.month = 2;<br>
+dv->date1.year = 1799;<br>
+dv->date1.year_type = YEAR_SINGLE;<br>
+gedcom_normalize_date(DI_FROM_NUMBERS, dv);<br>
+ <br>
+dv->date1.cal = CAL_FRENCH_REV;<br>
+gedcom_normalize_date(DI_FROM_SDN, dv);<br>
+/* the day, month and year are now filled in according to the French Revolution calendar */</code><br>
+ </blockquote>
+
+<blockquote>