Bug 389

Summary: Incorrect user's age was returned
Product: online shop management system Reporter: Silvia <potleung4-c>
Component: UserAssignee: Silvia <potleung4-c>
Status: RESOLVED FIXED    
Severity: normal CC: potleung4-c
Priority: High    
Version: 1.0.0   
Hardware: PC   
OS: Windows   

Description Silvia 2020-11-05 23:20:00 HKT
Today is 05/11/2020, the day of birth of the user is 25/12/2000. The correct age 19 maybe return but the system returns 20.
Comment 1 Silvia 2020-11-05 23:38:21 HKT
The user is not birthday yet but the system returns the age is greater than his own age. For example, today is 05/11/2020, the day of birth of the user is 25/12/2000. The correct age 19 should be returned by the system but the system returns 20.
Comment 2 Silvia 2020-11-10 15:26:32 HKT
Today is 05/11/2020, the day of birth of the user is 25/12/2000.
Step of the test:
1. Create a new user
2. Enter the data of the user
3. Calculate the age based on the entered birth of day of user
19 should be the expected output but 20 is observed
Comment 3 Silvia 2020-11-10 15:33:58 HKT
This issue is resolved by Calculating the age step by step. First, calculate the year. Then calculate the same month but the day is bigger than today's day, if it is true then the age will -1. After that, calculate the month only, if the birthday month is bigger than the current month, the age will -1.