mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-4551 merges #52 which adds support for rfc3339 date-only date-format
This commit is contained in:
@@ -93,9 +93,10 @@ public class DateConverter extends DefaultTypeConverter {
|
||||
DateFormat d2 = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
|
||||
DateFormat d3 = DateFormat.getDateInstance(DateFormat.LONG, locale);
|
||||
|
||||
DateFormat rfc3399 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||
DateFormat rfc3339 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||
DateFormat rfc3339dateOnly = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
return new DateFormat[]{dt1, dt2, dt3, rfc3399, d1, d2, d3};
|
||||
return new DateFormat[]{dt1, dt2, dt3, rfc3339, d1, d2, d3, rfc3339dateOnly};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -109,6 +109,13 @@ public class XWorkConverterTest extends XWorkTestCase {
|
||||
assertEquals(date, ts);
|
||||
java.sql.Time time1 = (java.sql.Time) converter.convertValue(context, null, null, null, datetStr, java.sql.Time.class);
|
||||
assertEquals(datet, time1);
|
||||
|
||||
Date dateWithTime = format.parse("01/10/2001 01:02:03");
|
||||
Date dateRfc3339 = (Date) converter.convertValue(context, null, null, null, "2001-01-10T01:02:03", Date.class);
|
||||
assertEquals(dateWithTime, dateRfc3339);
|
||||
|
||||
Date dateRfc3339DateOnly = (Date) converter.convertValue(context, null, null, null, "2001-01-10", Date.class);
|
||||
assertEquals(date, dateRfc3339DateOnly);
|
||||
}
|
||||
|
||||
public void testFieldErrorMessageAddedForComplexProperty() {
|
||||
|
||||
Reference in New Issue
Block a user