PropertyGroupValues and type=date
PostPosted:Tue Nov 04, 2014 8:26 am
Hi there,
I got a strange bug when using dates in PropertyGroups. But first, what did I do?
Assume the following PropertyGroup.xml.
There the date is presented as:
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:
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
I got a strange bug when using dates in PropertyGroups. But first, what did I do?
Assume the following PropertyGroup.xml.
Code: Select all
Now, I set the PropertyValues via OpenKM SDK to:
<?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>
Code: Select all
So, everthing is fine here. Then I log into OpenKM and open the property group in the frontend. dateid=18-06-2007
There the date is presented as:
Code: Select all
So I debugged the OKMPropertyGroup.java : getProperties.My awesome Date: 03-12-0017
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
The GWTFormElement like this:
{label=My awesome Date, name=dateid, value=18-06-2007, data=, width=100px, height=25px, readonly=false, type=date, validators=[]}
Code: Select all
So, where does date=Sun Dec 05 22:00:07 CET 17 come from?{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=}
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