From 107688ac36ceef4494d124b7d66deb56dda89b83 Mon Sep 17 00:00:00 2001
From: tina <lt-bloody@riox.eu>
Date: Fri, 28 Sep 2018 13:45:55 +0200
Subject: [PATCH] checks whether reminder date is already passed

---
 lib/notifications.js | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/notifications.js b/lib/notifications.js
index 06056427..74427d2d 100644
--- a/lib/notifications.js
+++ b/lib/notifications.js
@@ -64,14 +64,17 @@ function setupPeriodReminder() {
       .hours(6)
       .minutes(0)
       .seconds(0)
+
+    if (reminderDate.isAfter()) {
     // period is likely to start in 3 to 3 + (length of prediction - 1) days
-    const daysToEndOfPrediction = bleedingPrediction[0].length + 2
+      const daysToEndOfPrediction = bleedingPrediction[0].length + 2
 
-    Notification.localNotificationSchedule({
-      id: '2',
-      message: labels.periodReminder.notification(daysToEndOfPrediction),
-      date: reminderDate.toDate(),
-      vibrate: false
-    })
+      Notification.localNotificationSchedule({
+        id: '2',
+        message: labels.periodReminder.notification(daysToEndOfPrediction),
+        date: reminderDate.toDate(),
+        vibrate: false
+      })
+    }
   }
 }
\ No newline at end of file
-- 
GitLab