From 17f7091c32a6b0dcbd69e457533a4e75c896c4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Sun, 28 May 2023 11:05:00 -0600 Subject: 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. --- src/main/java/com/encora/Main.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/java/com') 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()); } -- cgit v1.2.3