Skip to content

Commit

Permalink
dateTime bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wyt-sonia committed Feb 25, 2020
1 parent a1c3d00 commit 4d6087d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion data/tasks.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
T | 0 | CS2101 Reading
T | 0 | CS2103T IP finalize
D | 0 | CS2105 Assignment1 | 23:59 01/03/2020
D | 0 | 11 | 02:20 20/03/2020
E | 0 | 111 | 02:20 20/03/2020-02:25 20/03/2020
6 changes: 4 additions & 2 deletions src/main/java/hakunamatata/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public ArrayList<Task> load() {
case "E":
String[] eventStartAndEndDateTimes = recordInfoParts[3].split("-");
temp = new Event(recordInfoParts[2].trim(),
LocalDateTime.parse(eventStartAndEndDateTimes[0].trim()),
LocalDateTime.parse(eventStartAndEndDateTimes[1].trim()), isDone);
LocalDateTime.parse(eventStartAndEndDateTimes[0].trim(), Task.DATETIME_FORMAT),
LocalDateTime.parse(eventStartAndEndDateTimes[1].trim(), Task.DATETIME_FORMAT), isDone);
break;
default:
break;
Expand All @@ -74,6 +74,8 @@ public ArrayList<Task> load() {
}
} catch (FileNotFoundException ex) {
System.out.println(ex.getMessage());
} catch (Exception ex) {
System.out.println(ex.getMessage());
} finally {
return records;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hakunamatata/command/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public AddCommand(Task task) {
public String execute(TaskList tasks, Ui ui, Storage storage) throws HakunaMatataException {
tasks.getTasks().add(task);
int originalListSize = tasks.getSize();
assert tasks.getSize() == originalListSize + 1 : "The size of task list didn't change after insertion,"
assert tasks.getSize() != originalListSize + 1 : "The size of task list didn't change after insertion,"
+ " please check.";
storage.save(tasks);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hakunamatata/command/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public String execute(TaskList tasks, Ui ui, Storage storage) throws HakunaMatat
}

tasks.getTasks().remove(index - 1);
assert tasks.getSize() == originalListSize - 1 : "The size of task list didn't change after deletion,"
assert tasks.getSize() != originalListSize - 1 : "The size of task list didn't change after deletion,"
+ " please check.";
storage.save(tasks);

Expand Down
1 change: 0 additions & 1 deletion src/main/java/hakunamatata/task/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public LocalDateTime getBy() {
*/
@Override
public String toString() {

return "[D]" + super.toString()
+ " (by: " + Parser.getDateTimeString(this.by) + ")";
}
Expand Down

0 comments on commit 4d6087d

Please sign in to comment.