aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-28 11:05:00 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-28 11:05:00 -0600
commit17f7091c32a6b0dcbd69e457533a4e75c896c4a2 (patch)
treec728e595f93b3a2136db82a2ab9994a3a23e1d6c /src/main/java/com
parentf1d7b4395d62a13a1d6307700adb7924e6809d23 (diff)
downloadToDo-App-BE-17f7091c32a6b0dcbd69e457533a4e75c896c4a2.tar.gz
ToDo-App-BE-17f7091c32a6b0dcbd69e457533a4e75c896c4a2.zip
Can set due date to null from edit.
If the date is the timestamp 0 (i.e. 1970/01/01), the due date will be set as null.
Diffstat (limited to '')
-rw-r--r--src/main/java/com/encora/Main.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/encora/Main.java b/src/main/java/com/encora/Main.java
index 1478229..ad86fc4 100644
--- a/src/main/java/com/encora/Main.java
+++ b/src/main/java/com/encora/Main.java
@@ -81,7 +81,13 @@ public class Main {
if (toDo.text().length() > 120) throw new longerThanMaxException();
selectedToDo.setText(toDo.text());
}
- if (toDo.dueDate() != null) selectedToDo.setDueDate(toDo.dueDate());
+ if (toDo.dueDate() != null) {
+ if (toDo.dueDate().equals(new Date(0))) {
+ selectedToDo.setDueDate(null);
+ } else {
+ selectedToDo.setDueDate(toDo.dueDate());
+ }
+ }
if (toDo.priority() != null) selectedToDo.setPriority(toDo.priority());
}