add feature toggling

This commit is contained in:
Lee
2024-06-30 05:15:37 +01:00
parent 93350f1506
commit ee6456e4d8
14 changed files with 315 additions and 11 deletions

View File

@ -34,16 +34,13 @@ public class UserBirthday {
public int calculateAge() {
Calendar birthdayCalendar = Calendar.getInstance();
birthdayCalendar.setTime(this.getBirthday());
Calendar today = Calendar.getInstance();
int age = today.get(Calendar.YEAR) - birthdayCalendar.get(Calendar.YEAR);
// Check if the birthday hasn't occurred yet this year
if (today.get(Calendar.DAY_OF_YEAR) < birthdayCalendar.get(Calendar.DAY_OF_YEAR)) {
age--;
}
return age;
}
}