More generic use of event.
[familia.git] / src / math / yearline.c
1 #include "yearline.h"
2
3 int convert_date_to_height(struct date_value *dv)
4 {
5         struct date_value * date = gedcom_new_date_value(dv);
6
7         if (date->date1.year_type != YEAR_SINGLE) {
8                 debug("Date->OY conversion when type != YEAR_SINGLE");
9         }
10
11         if (date->date1.cal != CAL_GREGORIAN) {
12                 debug("Not a gregorian calendar. Converting...");
13                 date->date1.cal = CAL_GREGORIAN;
14                 date->date1.year_type = YEAR_SINGLE;
15         }
16
17         if (gedcom_normalize_date(DI_FROM_SDN, date) != 0) {
18                 debug("Error when normalizing date");
19         }
20
21         int year = date->date1.year;
22
23         free(date);
24
25         return year;
26 }