From 35a71b925779d7c6c8f861f1b31b16a0d197b206 Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 17 Feb 2012 18:42:35 -0500 Subject: [PATCH] Fixed date bugs on IssueModel --- src/com/gitblit/models/IssueModel.java | 7 ++++++- src/com/gitblit/utils/JsonUtils.java | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) 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); -- 2.39.5