Page 1 of 1

PropertyGroupValues and type=date

PostPosted:Tue Nov 04, 2014 8:26 am
by Catscratch
Hi there,

I got a strange bug when using dates in PropertyGroups. But first, what did I do?

Assume the following PropertyGroup.xml.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.2//EN" "http://www.openkm.com/dtd/property-groups-2.2.dtd">
<property-groups>
  <property-group label="DEMO" name="demoid">
   <input label="My awesome Date" type="date" name="dateid" />
  </property-group>
</property-groups>
Now, I set the PropertyValues via OpenKM SDK to:
Code: Select all
dateid=18-06-2007
So, everthing is fine here. Then I log into OpenKM and open the property group in the frontend.
There the date is presented as:
Code: Select all
My awesome Date: 03-12-0017
So I debugged the OKMPropertyGroup.java : getProperties.
In the Debugger the ret variable is right. So the date is still 18-06-2007 inside.

In the PropertyGroupServlet.java : getProperties the GWTFormElement is also correct.

So my question is, why is the date wrong in the browser, but right in the backend. Did you do some kind of convertion via JavaScript or some other magic when leaving the backend code?

Thanks for hints.

Edit: I found something. In PropertyGroupServlet:java - line 210 you copy the FormElement to a GWTFormElement.

The FormElement looks like this:
Code: Select all
{label=My awesome Date, name=dateid, value=18-06-2007, data=, width=100px, height=25px, readonly=false, type=date, validators=[]}
The GWTFormElement like this:
Code: Select all
{label=My awesome Date, name=dateid, value=18-06-2007, width=100px, height=25px, readonly=false, type=date, validators=[], date=Sun Dec 05 22:00:07 CET 17, data=}
So, where does date=Sun Dec 05 22:00:07 CET 17 come from?

Edit2: I found it. Seems like you changed the date format in some of the last updates. In the past it was 'dd-MM-yyyy' now it is 'yyyyMMddHHmmss'. I changed my API call to the new format and now it is working.

CLOSE

Re: PropertyGroupValues and type=date

PostPosted:Sat Nov 08, 2014 10:35 am
by jllort
Sorry but it's something not well explained in documentation. As you discovered the input fields with type date save information with pattern "yyyyMMddHHmmss", this is an aproximation to ISO8601 except for what we've decided to do not store the TZD ( the timezone, now I do not want to extend the explanation why we've done this decision ).

I've updated this wiki section http://wiki.openkm.com/index.php/Form_E ... tion#Input .Actually we're involved on doing entire documentation in new format etc... Apology for the actual documentation, during this time we've learnt a lot about what we want and what not. Our plan is got new documentation at April of 2015, I know, it's a long time.