forked from Fascinated/Bat
add feature toggling
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user