Skip to content

Commit

Permalink
Modify the minor error
Browse files Browse the repository at this point in the history
  • Loading branch information
BILLXYR committed Sep 17, 2020
1 parent 67ed110 commit 0a97c3e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/main/java/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,18 @@ protected static String processDeadlineCommand(String input) throws InvalidExcep
} else {
int timeLength = isDone[isDone.length - 1].length();
int dateLength = isDone[isDone.length - 2].length();
String slashFirst = String.valueOf(isDone[isDone.length - 2].charAt(2));
String slashSecond = String.valueOf(isDone[isDone.length - 2].charAt(5));
if (timeLength < 4 || dateLength < 10 ) {
throw new InvalidDeadlineException("Fail to add task :( . "
+ "Please check the time and date format again. "
+ "The correct format should be dd/mm/yyyy tttt. Eg: 02/08/2019 1800");
} else if (!slashFirst.equals("/") || !slashSecond.equals("/")) {
throw new InvalidDeadlineException("Fail to add task :( . "
+ "Please check the time and date format again. "
+ "The correct format should be dd/mm/yyyy tttt. Eg: 02/08/2019 1800");
} else {
String slashFirst = String.valueOf(isDone[isDone.length - 2].charAt(2));
String slashSecond = String.valueOf(isDone[isDone.length - 2].charAt(5));
if (!slashFirst.equals("/") || !slashSecond.equals("/")) {
throw new InvalidDeadlineException("Fail to add task :( . "
+ "Please check the time and date format again. "
+ "The correct format should be dd/mm/yyyy tttt. Eg: 02/08/2019 1800");
}
}
}
int index = input.indexOf("/by");
Expand Down Expand Up @@ -172,16 +174,18 @@ protected static String processEventCommand(String input) throws InvalidExceptio
} else {
int timeLength = isDone[isDone.length - 1].length();
int dateLength = isDone[isDone.length - 2].length();
String slashFirst = String.valueOf(isDone[isDone.length - 2].charAt(2));
String slashSecond = String.valueOf(isDone[isDone.length - 2].charAt(5));
if (timeLength < 4 || dateLength < 10 ) {
throw new InvalidEventException("Fail to add task :( . "
+ "Please check the time and date format again. "
+ "The correct format should be dd/mm/yyyy tttt. Eg: 02/08/2019 1800");
} else if (!slashFirst.equals("/") || !slashSecond.equals("/")) {
throw new InvalidEventException("Fail to add task :( . "
+ "Please check the time and date format again. "
+ "The correct format should be dd/mm/yyyy tttt. Eg: 02/08/2019 1800");
} else {
String slashFirst = String.valueOf(isDone[isDone.length - 2].charAt(2));
String slashSecond = String.valueOf(isDone[isDone.length - 2].charAt(5));
if (!slashFirst.equals("/") || !slashSecond.equals("/")) {
throw new InvalidEventException("Fail to add task :( . "
+ "Please check the time and date format again. "
+ "The correct format should be dd/mm/yyyy tttt. Eg: 02/08/2019 1800");
}
}
}
int index = input.indexOf("/at");
Expand Down

0 comments on commit 0a97c3e

Please sign in to comment.