Skip to content

Commit

Permalink
Fixed the date bug
Browse files Browse the repository at this point in the history
  • Loading branch information
arepina committed Jan 11, 2018
1 parent c3b3504 commit 255aef7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/com/github/mobile/api/model/Milestone.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class Milestone implements Serializable {

public Date due_on;

private String url;

public Milestone() {
}

Expand All @@ -59,6 +61,7 @@ public Milestone(org.eclipse.egit.github.core.Milestone milestone) {
this.open_issues = milestone.getOpenIssues();
this.closed_issues = milestone.getClosedIssues();
this.created_at = milestone.getCreatedAt();
this.url = milestone.getUrl();
//todo this.updated_at=???
this.due_on = milestone.getDueOn();
}
Expand All @@ -73,8 +76,7 @@ public org.eclipse.egit.github.core.Milestone getOldModel() {
milestone.setDescription(description);
milestone.setState(state);
milestone.setTitle(title);
//todo milestone.setUrl();
//no url in this class
milestone.setUrl(url);
milestone.setCreator(creator.getOldModel());

return milestone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import static com.github.mobile.Intents.EXTRA_MILESTONE;
import static com.github.mobile.Intents.EXTRA_REPOSITORY_NAME;
Expand Down Expand Up @@ -232,8 +233,10 @@ private void updateMilestone() {
dateText.setText(date.toString());
}
catch (ParseException e){
e.printStackTrace(); //todo fix the unparseable date
dateText.setText(dueOn.toString());
Calendar cal = new GregorianCalendar();
cal.setTime(dueOn);
dateText.setText(sd.format(cal.getTime()));
//dateText.setText(dueOn.toString());
}
} else {
dateText.setText("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class MilestoneFragment extends DialogFragment {
public void onAttach(Context context) {
super.onAttach(context);

milestone = (Milestone) getSerializableExtra(EXTRA_MILESTONE);
milestone = ((com.github.mobile.api.model.Milestone)getSerializableExtra(EXTRA_MILESTONE)).getOldModel();
}

@Override
Expand Down

0 comments on commit 255aef7

Please sign in to comment.