generated from codeforamerica/form-flow-starter-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start adding logic for mapping ece fields to ours in for Jackson
conversion.
- Loading branch information
Showing
2 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/org/ladocuploader/app/utils/HouseholdUtilities.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.ladocuploader.app.utils; | ||
|
||
import java.util.Calendar; | ||
|
||
public class HouseholdUtilities { | ||
|
||
public static boolean isMember18orOlder(int day, int month, int year) { | ||
|
||
Calendar memberBirthDayCal = Calendar.getInstance(); | ||
memberBirthDayCal.set(Calendar.YEAR, year); | ||
memberBirthDayCal.set(Calendar.MONTH, month); | ||
memberBirthDayCal.set(Calendar.DAY_OF_MONTH, day); | ||
|
||
Calendar cal = Calendar.getInstance(); | ||
cal.set(year, month, day); | ||
cal.add(Calendar.YEAR, -18); | ||
|
||
// these are converted to milliseconds since Epoch and then compared. | ||
// if the memberBirthDayCal is < or == the cal, then they are 18+ years old. | ||
return memberBirthDayCal.compareTo(cal) <= 0; | ||
} | ||
} |