Skip to content

Commit

Permalink
Fixed bugged EndTime constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Ong authored and Kevin Ong committed Nov 2, 2016
1 parent 33aa77b commit b279473
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/main/java/seedu/address/model/activity/event/EndTime.java
Expand Up @@ -41,8 +41,8 @@ public EndTime(StartTime starttime, String date) throws IllegalValueException {
throw new IllegalValueException("Start Time Invalid");
}
// String[] recurring = starttime.RecurringMessage.split(" ");
if (starttime.recurring){
if(date.equals("")){
if (starttime.recurring) {
if(date.equals("")) {
recurring = true;
String recu[] = starttime.RecurringMessage.split(" ");
Calendar startcal = starttime.value;
Expand All @@ -51,17 +51,20 @@ public EndTime(StartTime starttime, String date) throws IllegalValueException {
RecurringMessage = recu[0] + " " + format1.format(startcal.getTime());
this.value = DateUtil.EndDateTime(startdate);
}
else {recurringEndTime(starttime, startdate, date);
setDate(date);}
else {
recurringEndTime(starttime, startdate, date);
setDate(date);
}
else if (date.equals("")) {
} else if (date.equals("")) {
this.value = DateUtil.EndDateTime(startdate);
} else if(date.split(" ").length==1){
Calendar startcal = starttime.value;
SimpleDateFormat format1 = new SimpleDateFormat("d-MM-yyyy");
date = format1.format(startcal) + " " + date;
setDate(date);
}
} else {
setDate(date);
}

}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/guitests/AddCommandTest.java
Expand Up @@ -20,7 +20,7 @@ public void add() {
TestActivity[] currentList = td.getTypicalActivities();
TestActivity activityToAdd = td.findHoon;

assertAddSuccess(activityToAdd, currentList);
assertAddSuccess(activityToAdd, currentList);
currentList = TestUtil.addPersonsToList(currentList, activityToAdd);

//add a task
Expand Down

0 comments on commit b279473

Please sign in to comment.