Bug 95699 - Birthday calculation is incorrect
Summary: Birthday calculation is incorrect
Status: RESOLVED NOT A BUG
Alias: None
Product: kontact
Classification: Applications
Component: summary (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Tobias Koenig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-23 00:14 UTC by Dave Flogeras
Modified: 2005-05-05 18:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Flogeras 2004-12-23 00:14:18 UTC
Version:            (using KDE KDE 3.3.1)
Installed from:    Gentoo Packages
Compiler:          gcc (GCC) 3.4.3  (Gentoo Linux 3.4.3, ssp-3.4.3-0, pie-8.7.6.6) -march=k8 -O2 -pipe
OS:                Linux

I have someones birthday (December 28 1950) in addressbook, the summary page in Kontact shows their age as 18446744073709551570 years.  I tried setting their birthday to the same date in the year 2000, and it calculated it correctly.  Next I tried setting someone elses birthday to a date within 7 days of todays date, year = 1950, and a similar error occurred.

Upon further investigation, I found that setting someones birthday to Dec 23 1968 produced a huge number, changing it to Dec 23 1969 was fine....

Please note that this is on amd64, so I guess its a possible 64 bit error.
Comment 1 Raphaël Vinet 2004-12-31 13:50:23 UTC
Hi,


I confirm this bug with a test I've done today (31-12-2004) with a mandrake 10.1 Official and the rpm kdepim-kontact-3.3.0-29.2.101mdk (see below)


Remarks:
1. I use on my system a user for who Kontact is totally NULL (no kmail initiated, no contacts, no event introduced in korganizer,  ...)
2. I use the date format standard for belgium (DD/MM/YYYY) so in KDE control center (Accessibility/Country-Region and language), my settings are:
- Weekday dD MONTH YYYY for the format date
- DD/MM/YY for the short format date

A. Case without problem:
1. Start KDE
2. Start Kontact ==> you have the summary screen
3. Choose the option "Contacts"
4. Click on the "New Contact" button ==> you have the window named "Edit Contact - Kontact)
5. In the tabsheet "General", add test in the field "Edit Name"
6. Tabsheet "Details", click on the listval arrow for the field "Birthdate" ==> per default it's the system date (31/12/2004).
7. Click on the month and choose january on the list
8. Click on the year, modify 2004 with 1978 + enter
9. Modify the day (31 ==> 4) + enter ==> so the displayed birthday is 01/01/78
10. Click on the button "Apply"
11. Click on the button "OK" ==> the window "Edit Contact - Kontact" is closed and the contact is visible
12. Choose the option "Summary"

Result:
You see the cake icon, the delay for the birthday (in 4 days), the birthdate introduced (04/01/78), the contact's name (test) and the calculation of the age (27) ==> it's correct.


B. Case with problem:
1. I delete the contact named test I created in my first test
2. Choose the option "Contacts"
3. Click on the "New Contact" button ==> you have the window named "Edit Contact - Kontact)
4. In the tabsheet "General", add test in the field "Edit Name"
5. Tabsheet "Details", click on the listval arrow for the field "Birthdate" ==> per default it's the system date (31/12/2004).
6. Do not modify the month (december)
7. Click on the year, modify 2004 with 1951 + enter
8. Do not modify the day (31) + enter ==> so the displayed birthday is 31/12/51

!!! Important remark !!!
If you reclick on the listval button, the date isn't more December 1951 but December 2051 

11. Click on the button "Apply"
12. Click on the button "OK" ==> the window "Edit Contact - Kontact" is closed and the contact is visible
13. Choose the option "Summary"

Result:
You see the cake icon, the delay for the birthday (today), the birthdate introduced (31/12/51), the contact's name (test) and the calculation of the age (4294967249) ... that's a little bit too much for my mum (mummy ??? :-) ) ==> of course it's not correct.


A+
Raph
Comment 2 Tobias Koenig 2005-03-22 18:50:24 UTC
Hi,

please use always a date format with 4 digits, otherwise the PC will never know whether 82 is 1982 or 2082...

Ciao,
Tobias
Comment 3 Iñaki Baz Castillo 2005-05-05 18:19:14 UTC
Ok, so now we know that we must use 4 digits to Kontact works fine. But what about the new users who haven't read this "bug"? Is it neccesary that the know this "problem" and this "solution"?

I think Kontact should interpretate 64 as 1964 in the birthday field. So, the solution may be to compare the 2 digits of the actual year with the 2 digits of the birthday:


For example:
- this year is 05
- the birthday is 64
- 64 > 05 --> the real birthday is 1964

Other example:
- this year is 05
- the birthday is 03
- 03 < 05 --> the real birthday is 2003

I know this is not a perfect solution. The best should be to FORCE the user to introduce the 4 digits, so two digits in the year shoul show a error message and explain the user to introduce the four digits.