Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug #82 #93

Merged
merged 2 commits into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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