summaryrefslogtreecommitdiff
path: root/plugins/WhenWasIt/src/date_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/WhenWasIt/src/date_utils.cpp')
-rw-r--r--plugins/WhenWasIt/src/date_utils.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/WhenWasIt/src/date_utils.cpp b/plugins/WhenWasIt/src/date_utils.cpp
index c10fdfe56b..41ab186044 100644
--- a/plugins/WhenWasIt/src/date_utils.cpp
+++ b/plugins/WhenWasIt/src/date_utils.cpp
@@ -30,7 +30,7 @@ time_t Today()
bool IsDOBValid(int year, int month, int day)
{
- return (year != 0 && month != 0 && day != 0);
+ return (month != 0 && day != 0);
}
int GetContactDOB(MCONTACT hContact, int &year, int &month, int &day)
@@ -76,7 +76,10 @@ int GetContactAge(MCONTACT hContact)
time(&tNow);
struct tm *now = localtime(&tNow);
GetContactDOB(hContact, year, month, day);
- return (now->tm_year + 1900) - year;
+ if (year == 0)
+ return 0;
+ else
+ return (now->tm_year + 1900) - year;
}
char GetContactGender(MCONTACT hContact)