OpenFaces icon indicating copy to clipboard operation
OpenFaces copied to clipboard

OpenFaces CompositeFilter inconsistent date format

Open antoniojxk opened this issue 9 years ago • 0 comments

I am using a CompositeFilter in order to filter a PrimeFaces datatable.

The filter is declared like this:

<o:compositeFilter id="filter" 
                   value="#{bean.criteria}"
                   labels="#{messages}"
                   noFilterMessage="#{messages.no_filter_message}"
                                           >
                            ...
                   <o:filterProperty value="#{msgs.label}" 
                                     name="id.startDate"
                                     type="date"
                                     pattern="dd/MM/yyyy"
                                              />
                           ...
</o:compositeFilter>

I have a problem with filter properties of type "date". When I select the operator "between" the date format for the two fields is not dd/MM/yyyy but something like this "07-may-2015". In contrast, the fields for the other operators (=, <, > and so on) get formatted as dd/MM/yyyy.

I use the following regional configuration:

faces-config:

<locale-config> 
            <default-locale>es</default-locale>  
</locale-config>

xhtml

<f:view locale="es" />

The HTTP request header

Accept-Language: es,en-US;q=0.8,en;q=0.6

While experimenting with these parameters, I found that if I used

<f:view locale="es_CO" />

Then the fields for the operator "between" get formatted as dd/MM/yyyy. Nevertheless I could not use this configuration because the number format interpretation changed as well. The es locale uses "." as decimal separator, but in this case the decimal separator used was ",". Then on the server side, the a number like 1123 was interpreted as 1.123.

I also noted that the online demo does not use date-type properties. Has anyone tried something like this?

Thanks for the help.

antoniojxk avatar May 20 '15 16:05 antoniojxk