Author: phuong_vu
Date: 2010-09-13 05:30:45 -0400 (Mon, 13 Sep 2010)
New Revision: 4167
Modified:
portal/branches/branch-r4047/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java
portal/branches/branch-r4047/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java
Log:
GTNPORTAL-1377 Modify GroovyPrinter to use DateFormat.MEDIUM instead of FULL
Modified:
portal/branches/branch-r4047/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java
===================================================================
---
portal/branches/branch-r4047/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java 2010-09-13
09:16:57 UTC (rev 4166)
+++
portal/branches/branch-r4047/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java 2010-09-13
09:30:45 UTC (rev 4167)
@@ -111,7 +111,7 @@
{
if (locale != null)
{
- DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
+ DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM,
locale);
o = dateFormat.format((Date)o);
}
}
Modified:
portal/branches/branch-r4047/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java
===================================================================
---
portal/branches/branch-r4047/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java 2010-09-13
09:16:57 UTC (rev 4166)
+++
portal/branches/branch-r4047/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java 2010-09-13
09:30:45 UTC (rev 4167)
@@ -49,8 +49,8 @@
public void testDate1() throws Exception
{
GroovyTemplate template = new GroovyTemplate("<% print(new Date(0));
%>");
- assertEquals("jeudi 1 janvier 1970", template.render(Locale.FRENCH));
- assertEquals("Thursday, January 1, 1970",
template.render(Locale.ENGLISH));
+ assertEquals("1 janv. 1970", template.render(Locale.FRENCH));
+ assertEquals("Jan 1, 1970", template.render(Locale.ENGLISH));
assertEquals("Thu Jan 01 07:00:00 ICT 1970", template.render());
}
@@ -58,8 +58,8 @@
{
GroovyTemplate template = new GroovyTemplate("<% def date = new Date(0)
%>$date");
System.out.println("template.getGroovy() = " + template.getGroovy());
- assertEquals("jeudi 1 janvier 1970", template.render(Locale.FRENCH));
- assertEquals("Thursday, January 1, 1970",
template.render(Locale.ENGLISH));
+ assertEquals("1 janv. 1970", template.render(Locale.FRENCH));
+ assertEquals("Jan 1, 1970", template.render(Locale.ENGLISH));
assertEquals("Thu Jan 01 07:00:00 ICT 1970", template.render());
}
@@ -67,8 +67,8 @@
{
GroovyTemplate template = new GroovyTemplate("<%= new Date(0)
%>");
System.out.println("template.getGroovy() = " + template.getGroovy());
- assertEquals("jeudi 1 janvier 1970", template.render(Locale.FRENCH));
- assertEquals("Thursday, January 1, 1970",
template.render(Locale.ENGLISH));
+ assertEquals("1 janv. 1970", template.render(Locale.FRENCH));
+ assertEquals("Jan 1, 1970", template.render(Locale.ENGLISH));
assertEquals("Thu Jan 01 07:00:00 ICT 1970", template.render());
}
Show replies by date