From 64e9360e0dbf2cdeef7926e4d20e906895fd6bc3 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Mon, 22 Dec 2014 09:03:06 +0000 Subject: WhenWasIt: fix for birthday reminder when year not set (path by alitor) git-svn-id: http://svn.miranda-ng.org/main/trunk@11574 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/WhenWasIt/src/date_utils.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins/WhenWasIt') 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) -- cgit v1.2.3