Skip to content

Commit 4035f58

Browse files
committed
Prevent adding pattern based notifications if date is in the past
1 parent d383bcf commit 4035f58

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [1.1.0] - 2023-10-02
4+
5+
* Prevent adding pattern based notifications if date is in the past
6+
37
## [1.0.0] - 2023-10-01
48

59
Initial release

src/main/php/mealplan/controller/WeekEditController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ private function saveItem($mealData, int $itemIndex, Space $space): ?Meal
161161
$notificationDateTime = new DateTime(sprintf("%s %s", $date->format("Y-m-d"), $mealTypeNotificationTime->format("H:i:s")));
162162
$notificationDateTime->sub($notificationPattern->getDateInterval());
163163
$notificationText = $notificationPattern->getText();
164+
165+
// Prevent adding pattern based notifications if date is in the past
166+
if ($notificationDateTime->isInThePast()) {
167+
$notificationDateTime = null;
168+
}
164169
}
165170
}
166171
} else {

0 commit comments

Comments
 (0)