Skip to content

Commit

Permalink
Merge pull request #93 from AndreySBer/bugfix-82-createMilestone
Browse files Browse the repository at this point in the history
Fix bug #82
  • Loading branch information
phansier committed Jan 30, 2018
2 parents 6073cbc + fb43465 commit ae70857
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 2 additions & 3 deletions app/src/main/java/com/github/mobile/api/DateAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
import java.util.TimeZone;

public class DateAdapter {
private final DateFormat[] formats = new DateFormat[4];
private final DateFormat[] formats = new DateFormat[3];

public DateAdapter() {
formats[0] = new SimpleDateFormat("yyyy-MM-dd\'T\'HH:mm:ss\'Z\'");
formats[1] = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss Z");
formats[2] = new SimpleDateFormat("yyyy-MM-dd\'T\'HH:mm:ss");
formats[3] = new SimpleDateFormat("yyyy-MM-dd\'T\'HH:mm:ss\'ZZ\'");
final TimeZone timeZone = TimeZone.getTimeZone("Zulu");
for (DateFormat format : formats) {
format.setTimeZone(timeZone);
Expand All @@ -41,7 +40,7 @@ public DateAdapter() {

@ToJson
String toJson(Date date) {
return formats[3].format(date);
return formats[0].format(date);
}

@FromJson
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/github/mobile/api/model/Milestone.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Date;

public class Milestone implements Serializable {
public static final String MS_STATE_OPEN = "open";
public long id;

public int number;
Expand Down Expand Up @@ -46,6 +47,7 @@ public class Milestone implements Serializable {
private String url;

public Milestone() {
state = MS_STATE_OPEN;
}

public Milestone(org.eclipse.egit.github.core.Milestone milestone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth
dateAndTime.set(Calendar.MONTH, monthOfYear);
dateAndTime.set(Calendar.DAY_OF_MONTH, dayOfMonth);
final Date startDate = dateAndTime.getTime();
String fdate = sd.format(startDate);
etDate.setText(fdate);
updateDate(startDate);
}
}, dateAndTime.get(Calendar.YEAR), dateAndTime.get(Calendar.MONTH), dateAndTime.get(Calendar.DAY_OF_MONTH)).show();

Expand Down Expand Up @@ -348,7 +347,10 @@ private void updateDate(Date date) {
milestone.due_on = null;
} else {
etDate.setVisibility(View.VISIBLE);
mDate = date;
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.HOUR, 8);
mDate = c.getTime();
SimpleDateFormat sd = new SimpleDateFormat(getApplicationContext().getString(R.string.ms_date_format));
String fdate = sd.format(date);
etDate.setText(fdate);
Expand Down

0 comments on commit ae70857

Please sign in to comment.