Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #200 from lordidiot/fix-birthday
Browse files Browse the repository at this point in the history
Fix inaccurate birthday notification behaviour
  • Loading branch information
lordidiot committed Nov 7, 2023
2 parents e706707 + 6471e73 commit ada8718
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/seedu/address/model/event/EventFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ private static List<Event> createBirthdayEvents(Model model) {
);

// Birthday has not passed this year
if (birthdayThisYear.isAfter(LocalDate.now())) {
if (birthdayThisYear.isAfter(LocalDate.now()) || birthdayThisYear.equals(LocalDate.now())) {
event = new Event(
String.format("%s's Birthday", person.getName()), "",
birthdayThisYear.atTime(0, 0)
birthdayThisYear.atTime(23, 59)
);
} else {
event = new Event(
String.format("%s's Birthday", person.getName()), "",
birthdayNextYear.atTime(0, 0)
birthdayNextYear.atTime(23, 59)
);
}

event.addReminder(Duration.ofDays(1)); // Birthday reminder defaults to 1 day in advance
event.addReminder(Duration.ofDays(2)); // Birthday reminder within 1 day of the birthday
event.addMember(person);
events.add(event);
}
Expand Down

0 comments on commit ada8718

Please sign in to comment.