package seedu.ezdo.commons.util;

import seedu.ezdo.model.todo.ReadOnlyTask;

//@@author A0139177W
/**
 * Utility method for Recur
 */
public class RecurUtil {

    /**
     * Checks if a recurring status is valid with at least a start date and/or
     * due date present in a task. Floating tasks should not have a recurring
     * status.
     * @param task
     * @return false if the task is a floating task
     * @return true otherwise
     */
    public static boolean isRecurValid(ReadOnlyTask task) {
        assert task != null;
        String taskStartDate = task.getStartDate().toString();
        String taskDueDate = task.getDueDate().toString();
        final boolean isStartDateMissing = taskStartDate.isEmpty();
        final boolean isDueDateMissing = taskDueDate.isEmpty();
        if (isStartDateMissing && isDueDateMissing) {
            return false;
        } else {
            return true;
        }
    }

}

@@ -646,32 +646,33 @@
 e().toString();%0A
+%0A
         final bo
@@ -799,12 +799,43 @@
     
-if (
+final boolean isBothDatesMissing = 
 isSt
@@ -868,19 +868,17 @@
 eMissing
-) %7B
+;
 %0A       
@@ -882,40 +882,119 @@
     
+%0A
     
-return false;%0A        %7D else
+    final boolean isRecurring = task.getRecur().isRecur();%0A%0A        if (isBothDatesMissing && isRecurring)
  %7B%0A 
@@ -1011,19 +1011,20 @@
  return 
-tru
+fals
 e;%0A     
@@ -1027,16 +1027,38 @@
        %7D
+%0A%0A        return true;
 %0A    %7D%0A%0A

Fix recur bug: Not working when floating task is added