Last active
January 1, 2018 08:17
-
-
Save smallufo/295c2e82fc1f09d7bede3acccad653e2 to your computer and use it in GitHub Desktop.
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
LocalDateTime getNextFullMoon(LocalDateTime from); | |
default List<LocalDateTime> getYearlyFullMoons(int year) { | |
List<LocalDateTime> result = new ArrayList<>(); | |
LocalDateTime from = LocalDateTime.of(year , 1 , 1 , 0 , 0); | |
while (from.getYear() < year+1) { | |
LocalDateTime fullMoon = getNextFullMoon(from); | |
if (fullMoon.getYear() == year) | |
result.add(fullMoon); | |
from = fullMoon.plusDays(1); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment