Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
d6db2fca
Commit
d6db2fca
authored
Feb 05, 2015
by
Matija Obreza
Browse files
Pretty print date <local:prettyTime
parent
3aa42c14
Changes
6
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
d6db2fca
...
...
@@ -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>
...
...
src/main/webapp/WEB-INF/jsp/accession/details.jsp
View file @
d6db2fca
...
...
@@ -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
valu
e=
"
${
accession
.
lastModifiedDate
}
"
type=
"both
"
/>
<
local:prettyTime
dat
e=
"
${
accession
.
lastModifiedDate
}
"
locale=
"
${
pageContext
.
response
.
locale
}
"
/>
</div>
<content
tag=
"javascript"
>
...
...
src/main/webapp/WEB-INF/jsp/content/include/activitypost.jsp
View file @
d6db2fca
...
...
@@ -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
valu
e=
"
${
activityPost
.
postDate
.
time
}
"
/>
<
local:prettyTime
dat
e=
"
${
activityPost
.
postDate
.
time
}
"
locale=
"
${
pageContext
.
response
.
locale
}
"
/>
</div>
</div>
src/main/webapp/WEB-INF/jsp/init.jsp
View file @
d6db2fca
...
...
@@ -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
src/main/webapp/WEB-INF/tags/prettyTime.tag
0 → 100644
View file @
d6db2fca
<%@ 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
src/test/java/org/genesys2/server/test/PrettyTimeTest.java
0 → 100644
View file @
d6db2fca
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
));
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment