From: James Moger Date: Fri, 17 Feb 2012 23:42:35 +0000 (-0500) Subject: Fixed date bugs on IssueModel X-Git-Tag: v0.9.0~96^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=35a71b925779d7c6c8f861f1b31b16a0d197b206;p=gitblit.git Fixed date bugs on IssueModel --- diff --git a/src/com/gitblit/models/IssueModel.java b/src/com/gitblit/models/IssueModel.java index 246b29bf..3c191e24 100644 --- a/src/com/gitblit/models/IssueModel.java +++ b/src/com/gitblit/models/IssueModel.java @@ -59,7 +59,8 @@ public class IssueModel implements Serializable, Comparable { public List changes; public IssueModel() { - created = new Date((System.currentTimeMillis() / 1000) * 1000); + // the first applied change set the date appropriately + created = new Date(0); type = Type.Defect; status = Status.New; @@ -117,6 +118,10 @@ public class IssueModel implements Serializable, Comparable { } public void applyChange(Change change) { + if (changes.size() == 0) { + // first change created the issue + created = change.created; + } changes.add(change); if (change.hasFieldChanges()) { diff --git a/src/com/gitblit/utils/JsonUtils.java b/src/com/gitblit/utils/JsonUtils.java index aea46bbb..bc9a1e00 100644 --- a/src/com/gitblit/utils/JsonUtils.java +++ b/src/com/gitblit/utils/JsonUtils.java @@ -295,7 +295,8 @@ public class JsonUtils { JsonDeserializationContext jsonDeserializationContext) { try { synchronized (dateFormat) { - return dateFormat.parse(jsonElement.getAsString()); + Date date = dateFormat.parse(jsonElement.getAsString()); + return new Date((date.getTime() / 1000) * 1000); } } catch (ParseException e) { throw new JsonSyntaxException(jsonElement.getAsString(), e);