Search in sources :

Example 1 with DateProperty

use of com.xpn.xwiki.objects.DateProperty in project xwiki-platform by xwiki.

the class DateClass method newProperty.

@Override
public BaseProperty newProperty() {
    BaseProperty property = new DateProperty();
    property.setName(getName());
    return property;
}
Also used : DateProperty(com.xpn.xwiki.objects.DateProperty) BaseProperty(com.xpn.xwiki.objects.BaseProperty)

Example 2 with DateProperty

use of com.xpn.xwiki.objects.DateProperty in project xwiki-platform by xwiki.

the class DateClassTest method toFormString.

@Test
public void toFormString() throws Exception {
    DateClass dateClass = new DateClass();
    dateClass.setDateFormat("MMMM yyyy");
    when(localizationContext.getCurrentLocale()).thenReturn(new Locale("ro"));
    DateProperty property = new DateProperty();
    property.setValue(new SimpleDateFormat("MM/yyyy").parse("10/2015"));
    assertEquals("octombrie 2015", dateClass.toFormString(property));
}
Also used : Locale(java.util.Locale) DateProperty(com.xpn.xwiki.objects.DateProperty) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Aggregations

DateProperty (com.xpn.xwiki.objects.DateProperty)2 BaseProperty (com.xpn.xwiki.objects.BaseProperty)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Locale (java.util.Locale)1 Test (org.junit.Test)1