problem DEAT bef a date
see https://www.webtrees.net/index.php/forum/2-open-discussion/40041-problem-deat-bef-a-date
My problem is that you can see that a person is considered to have lived longer (DEAT BEF 1950) than DEAT 1 JAN 1950 or 31 DEC 1949.
You are comparing an exact date with an inexact date.
This is a problem in many situations.
There is no simple answer to the question: Which comes first, 1950 or 30 JUN 1950?
If your dates were 1949, BEF 1950 and 1951, you would get the results you expect.
If your dates were 01 JAN 1949, BEF 01 JAN 1950 and 01 JAN 1951, you would get the results you expect.
For the statistics, will use the minimum/maximum value for the date (e.g. 01 JAN 1950/31 DEC 1950) when looking for things like the oldest person.
So, I think the code is working as designed, and I can't think of a better design.