Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
Primefaces datePicker range filter end date issue

I am using primefaces 10 dataTable

and I am tring to filter on java.util.date column as follows:

<p:column field="dateCreated" headerText="Request Date" filterMatchMode="range">
    <f:facet name="filter">
        <p:datePicker widgetVar="dateFilterWidget" pattern="yyyy/MM/dd"  selectionMode="range" onchange="dateFilterChange();">
          <f:convertDateTime type="date"  dateStyle="short" pattern="yyyy/MM/dd" />
        </p:datePicker>                             
    </f:facet>
    <h:outputText value="#{requestItem.dateCreated}">
        <f:convertDateTime pattern="yyyy/MM/dd hh:mm aa" locale="ar"/>
    </h:outputText>
</p:column>

ISSUE : the filter works as date >= startDate and date < endDate

and i want it to work like : date >= startDate and date <= endDate

Example : i have request create on 1 October and request created on 7 october if i choose the range from :

2021/10/01 - 2021/10/07 the request from 2021/10/07 does not appear in filter result

so i tried to hack the code as follows:

function dateFilterChange(){
             var datePicker = PF('dateFilterWidget');
             console.log(datePicker.getDate());
             if(datePicker.getDate() &amp;&amp; datePicker.getDate().length == 2 &amp;&amp; datePicker.getDate()[1]!= null){            
                 var endDate = datePicker.getDate()[1];
                 endDate.setHours(23, 59, 59);
                 console.log('endDate :'+endDate);
             }
             console.log(datePicker.getDate());             
             PF('inboxTableWidget').filter();
         }

but still getting same result.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can also opt to take care of this on the server side.

The range filter is handled by org.primefaces.model.filter.RangeFilterConstraint. You can overload this class in your project and modify the isInRange method to check for Dates the way you want to.

Or, if you are using a LazyDataModel, simply act on the provided org.primefaces.model.FilterMeta of MatchMode RANGE.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!