I try to override the format used by datetime field in the FilterBuilder.
Here's the output:
Before:{
"_constructor":"AdvancedCriteria",
"operator":"and",
"criteria":[
{
"fieldName":"installation_date",
"operator":"equals",
"value":"2015-02-20"
}
]
}
After:{
"_constructor":"AdvancedCriteria",
"operator":"and",
"criteria":[
{
"fieldName":"installation_date",
"operator":"equals",
"value":"2015-02-20"
}
]
}
I expected to see the "value" in the format "yyyy/MM/dd" but it just JSONDateFormat.XML_SCHEMA
How to I override the data format for the JSONEncoder ?
The used version is old one:
SmartClient Version: v9.0p_2014-04-23/PowerEdition Deployment (built 2014-04-23)
Code:
final JSONEncoder settings = new JSONEncoder(){
@Override
public String encodeDate(java.util.Date theDate){
String date= DateTimeFormat.getFormat("yyyy/MM/dd").format(theDate);
System.out.println("Date:" + date);
return date;
}
};
System.out.println("Before:" + this.filterBuilder.getCriteria().toJSON());
//settings.setDateFormat( JSONDateFormat.DATE_CONSTRUCTOR );
final String s = JSON.encode( this.filterBuilder.getCriteria().getJsObj(), settings );
System.out.println("After:" + s);Before:{
"_constructor":"AdvancedCriteria",
"operator":"and",
"criteria":[
{
"fieldName":"installation_date",
"operator":"equals",
"value":"2015-02-20"
}
]
}
After:{
"_constructor":"AdvancedCriteria",
"operator":"and",
"criteria":[
{
"fieldName":"installation_date",
"operator":"equals",
"value":"2015-02-20"
}
]
}
I expected to see the "value" in the format "yyyy/MM/dd" but it just JSONDateFormat.XML_SCHEMA
How to I override the data format for the JSONEncoder ?
The used version is old one:
SmartClient Version: v9.0p_2014-04-23/PowerEdition Deployment (built 2014-04-23)