Commit d6db2fca authored by Matija Obreza's avatar Matija Obreza

Pretty print date <local:prettyTime

parent 3aa42c14
......@@ -533,6 +533,11 @@
<artifactId>poi-ooxml</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime</artifactId>
<version>3.2.5.Final</version>
</dependency>
</dependencies>
<build>
......
......@@ -393,7 +393,7 @@
<div class="audit-info">
<c:if test="${accession.lastModifiedBy ne null}"><spring:message code="audit.lastModifiedBy" arguments="${jspHelper.userFullName(accession.lastModifiedBy)}" /></c:if>
<fmt:formatDate value="${accession.lastModifiedDate}" type="both" />
<local:prettyTime date="${accession.lastModifiedDate}" locale="${pageContext.response.locale}" />
</div>
<content tag="javascript">
......
......@@ -34,6 +34,6 @@
--%>
<%-- <spring:message code="audit.createdBy" arguments="${activityPost.createdBy.name}" /> --%>
<c:if test="${activityPost.lastModifiedBy ne null}"><spring:message code="audit.lastModifiedBy" arguments="${jspHelper.userFullName(activityPost.lastModifiedBy)}" /></c:if>
<fmt:formatDate value="${activityPost.postDate.time}" />
<local:prettyTime date="${activityPost.postDate.time}" locale="${pageContext.response.locale}" />
</div>
</div>
......@@ -3,4 +3,5 @@
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
\ No newline at end of file
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="local" tagdir="/WEB-INF/tags"%>
\ No newline at end of file
<%@ tag description="Pretty print a date" pageEncoding="UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ tag import="org.ocpsoft.prettytime.PrettyTime" %>
<%@ attribute name="date" required="true" type="java.util.Date" %>
<%@ attribute name="locale" required="true" type="java.util.Locale" %>
<%
PrettyTime p = new PrettyTime(locale);
%><%= p.format(date) %><%
%> <small><fmt:formatDate value="${date}" /></small>
\ No newline at end of file
package org.genesys2.server.test;
import java.util.Date;
import java.util.Locale;
import org.junit.Test;
import org.ocpsoft.prettytime.PrettyTime;
public class PrettyTimeTest {
@Test
public void testPretty() {
PrettyTime pt=new PrettyTime();
Date then = new Date();
System.out.println(pt.format(then));
}
@Test
public void testPrettyLocaleDe() {
Locale locale=Locale.GERMAN;
PrettyTime pt=new PrettyTime(locale);
Date then = new Date();
System.out.println(pt.format(then));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment