tsackton / taelgar

0 stars 0 forks source link

GetDescriptionOfDateInformation doesn't handle dates less than a year apart #10

Closed msackton closed 9 months ago

msackton commented 9 months ago

The getDescriptionOfDateInformation takes a date info (with a start date, end date, and age) and outputs one of the following strings:

However, the age is in years, so if you have someone who is (a) dead and (b) has birth/death dates in the same year, it incorrectly selects the pagePast rather than pagePastWithCurrent.

I have not checked to see if Python has the same bug.

msackton commented 9 months ago

This can be observed in the regnal dates for Charlotte II of Sembara

tsackton commented 9 months ago

Python had same bug, although now fixed. Source was:

        if date_info.get('isAlive'):
            format_str = page_display_data.get('pageCurrent', "")
        elif date_info.get('age'):
            format_str = page_display_data.get('pagePastWithStart', "")
        elif date_info.get('endDate'):
            format_str = page_display_data.get('pagePast', "")
        else:
            return ""

Where if age is 0, that is falsey, and so elif date_info.get('age') doesn't happen.