Skip to content

Instantly share code, notes, and snippets.

@BumpeiShimada
Last active November 22, 2018 01:46
Show Gist options
  • Save BumpeiShimada/e0a90eb0cd4d61f6f28a55d699f39788 to your computer and use it in GitHub Desktop.
Save BumpeiShimada/e0a90eb0cd4d61f6f28a55d699f39788 to your computer and use it in GitHub Desktop.
public class LoginLogic {
@Autowired
private OriginalTimeManager timeManager; // This is an in-house class for managing data related to dates
/**
* @param graduateYear
* @return whether current date is after or equal to graduate year's 1st April
* @throws NullPointerException if the param graduateYear is null
*/
boolean isAfterServiceGraduateDate(@NonNull Integer graduateYear) {
LocalDate serviceGraduateDate = LocalDate.of(graduateYear, 4, 1); // In Japan, students commonly graduates at the end of March
LocalDate currentLocalDate = timeManager.getCurrentLocalDate();
return currentLocalDate.isAfter(serviceGraduateDate) || currentLocalDate.isEqual(serviceGraduateDate);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment