-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
* B-Reminders * B-reminders modification * duke.java * modified buidl.gradle and Command * user guide * user guide table of contents * user guide link TOC * user guide * UI * corrected mock UI * rename UI * UI update
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#Thu Sep 26 21:58:55 SGT 2019 | ||
gradle.version=5.2.1 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package duke.command; | ||
|
||
import duke.exception.DukeException; | ||
import duke.storage.Storage; | ||
import duke.task.TaskList; | ||
import duke.ui.Ui; | ||
|
||
import java.time.LocalDate; | ||
import java.time.ZoneId; | ||
import java.util.Date; | ||
|
||
public class RemindCommand extends Command{ | ||
|
||
public RemindCommand() { | ||
|
||
} | ||
|
||
@Override | ||
public void execute(TaskList taskList, Ui ui, Storage storage) throws DukeException{ | ||
try { | ||
int num = 1; | ||
LocalDate date = LocalDate.now(); | ||
LocalDate endDate = date.plusDays(5); | ||
|
||
Date StartDate = Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()); | ||
Date EndDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); | ||
|
||
if(taskList.size() == 0) { | ||
System.out.println("You have no upcoming events/deadlines/todos"); | ||
} | ||
else { | ||
System.out.println("These are your Tasks in the next 5 days"); | ||
for(int a = 0; a < taskList.size(); a++) { | ||
Date TaskDate = taskList.getTask(a).getCurrentDate(); | ||
|
||
if((isWithinRange(TaskDate, EndDate, StartDate))) { | ||
System.out.println(num + ": " + taskList.getTask(a).toString()); | ||
num++; | ||
} | ||
} | ||
} | ||
} catch ( Exception e) { | ||
// | ||
} | ||
|
||
} | ||
|
||
private boolean isWithinRange(Date TaskDate, Date EndDate, Date StartDate) { | ||
return TaskDate.before(EndDate) && TaskDate.after(StartDate); | ||
} | ||
} |