Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Commit

Permalink
Iron out some incompatibilities from the merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Parcly-Taxel committed Aug 18, 2019
1 parent 7405e28 commit 317070a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/duke/task/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public String toString() {
/**
* Exports this Deadline for saving to disk.
*
* @return A string representation of this task containing the type marker E and a time.
* @return A string representation of this task containing the type marker D and a time.
*/
@Override
public String export() {
return "D|" + super.export() + "|" + by;
return "D|" + super.export() + "|" + by.format(inputFormatter);
}
}
2 changes: 1 addition & 1 deletion src/main/java/duke/task/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public String toString() {
*/
@Override
public String export() {
return "E|" + super.export() + "|" + at;
return "E|" + super.export() + "|" + at.format(inputFormatter);
}
}
7 changes: 5 additions & 2 deletions src/main/java/duke/task/TaskList.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package duke.task;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;

/**
Expand All @@ -8,6 +10,7 @@
*/
public class TaskList {
private final ArrayList<Task> tasks;
private static final DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("d/M/yyyy HHmm");

/**
* Initializes an empty task list.
Expand All @@ -31,10 +34,10 @@ public TaskList(ArrayList<String> stringTasks) {
t = new Todo(fields[2]);
break;
case "E":
t = new Event(fields[2], fields[3]);
t = new Event(fields[2], LocalDateTime.parse(fields[3], inputFormatter));
break;
case "D":
t = new Deadline(fields[2], fields[3]);
t = new Deadline(fields[2], LocalDateTime.parse(fields[3], inputFormatter));
break;
default:
t = new Todo("nothing");
Expand Down

0 comments on commit 317070a

Please sign in to comment.