FossifyOrg / Calendar

A simple calendar with events, customizable widgets and no ads.
https://www.fossify.org
GNU General Public License v3.0
723 stars 55 forks source link

Age incorrect for private contacts from Fossify Contacts who are born before 1970 #196

Open genodeftest opened 6 months ago

genodeftest commented 6 months ago

Checklist

Affected app version

1.0.3

Affected Android/Custom ROM version

Android 13, patchlevel 2024-01-05 (FP4.TP29.C.0101.20240121)

Affected device model

Fairphone 4

How did you install the app?

F-Droid / IzzyOnDroid

Steps to reproduce the bug

Precondition: In Fossify Contacts, have SettingsShow private contacts to Fossify Dialer, Fossify SMS Messenger and Fossify Calendar enabled.

  1. In Fossify Contacts, create a contact in Phone Storage (not visible by other apps)
  2. Fill in a birthday before 1970-01-01
  3. Save the contact
  4. Open Fossify Calendar. It will immediately import the added contact
  5. In Fossify Calendar, navigate to the contact's birthday anniversary (e.g. 2024-04-14 if the contact was born in 1962-04-14)

Expected behavior

Show the real age of the contact at their birthday anniversary. For a contact born on 1962-04-14, that would be 62 years on 2024-04-14.

Actual behavior

For every person born before 1970, the age is calculated as if they were born in 1970 (on the same day). I.e., the person born on 1962-04-14 would be shown age 54 on 2024-04-14, as if it were born on 1970-04-14.

Screenshots/Screen recordings

Contact:

Fossify Contacts

Calendar date (2024-04-14):

Fossify Calendar

Additional information

This issue had been reported against Simple Calendar before (SimpleMobileTools/Simple-Calendar/#1812), where @Aga-C gave a hint to the probable cause for this issue:

The problem is only with private contacts from Simple Contacts […]. It seems to be related to this fragment of code in MainActivity:

                    if (date.year < 70) {
                        date.year = 70
                    }

Fossify Calendar inherited this code in app/src/main/kotlin/org/fossify/calendar/activities/MainActivity.kt.

TristanDonze commented 6 months ago

Hello, me and @Yaassiihh will work on this

nofishonfriday commented 6 months ago

@Daemanon Are you still planning to work on it? To me it looks like simply removing the three lines in the opening post will fix it, but maybe I'm wrong?

TristanDonze commented 6 months ago

@nofishonfriday yes but we still haven't started it, we will probably next week, sorry for the inconvenience