Joda-Time for ISO6801 timestamps.

This commit is contained in:
Winston Li 2015-03-09 21:38:53 +00:00
parent e7c1b29008
commit 83db4e6a10
4 changed files with 22 additions and 14 deletions

View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: joda-time:joda-time:2.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/joda-time/joda-time/2.7/joda-time-2.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/joda-time/joda-time/2.7/joda-time-2.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/joda-time/joda-time/2.7/joda-time-2.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -97,6 +97,11 @@
<artifactId>slf4j-nop</artifactId>
<version>1.7.9</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.7</version>
</dependency>
</dependencies>
</project>

View file

@ -1,5 +1,6 @@
package uk.ac.ic.wlgitbridge.writelatex.model;
import org.joda.time.DateTime;
import uk.ac.ic.wlgitbridge.util.Util;
import uk.ac.ic.wlgitbridge.writelatex.api.request.getforversion.SnapshotAttachment;
import uk.ac.ic.wlgitbridge.writelatex.api.request.getforversion.SnapshotData;
@ -7,8 +8,6 @@ import uk.ac.ic.wlgitbridge.writelatex.api.request.getforversion.SnapshotFile;
import uk.ac.ic.wlgitbridge.writelatex.api.request.getsavedvers.SnapshotInfo;
import uk.ac.ic.wlgitbridge.writelatex.api.request.getsavedvers.WLUser;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -31,16 +30,7 @@ public class Snapshot implements Comparable<Snapshot> {
WLUser user = info.getUser();
userName = user.getName();
userEmail = user.getEmail();
TimeZone tz = TimeZone.getDefault();
Calendar cal = Calendar.getInstance(tz);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
sdf.setCalendar(cal);
try {
cal.setTime(sdf.parse(info.getCreatedAt()));
} catch (ParseException e2) {
throw new RuntimeException(e2);
}
createdAt = cal.getTime();
createdAt = new DateTime(info.getCreatedAt()).toDate();
srcs = data.getSrcs();
atts = data.getAtts();

View file

@ -43,6 +43,6 @@
<orderEntry type="library" name="Maven: org.eclipse.jgit:org.eclipse.jgit.http.server:3.6.0.201412230720-r" level="project" />
<orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.8.7" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-nop:1.7.9" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.7" level="project" />
</component>
</module>
</module>