How to disable selection of hours and minutes in dataTables.dateTime

How to disable selection of hours and minutes in dataTables.dateTime

poeziafreepoeziafree Posts: 35Questions: 11Answers: 0
edited August 2021 in SearchBuilder

Hello,

I am using SearchBuilder with DataTables.

One of my columns contains dates in the following format: 18.08.2021, 10:08

I need to disable/set to 00:00 the selection of date-time when filtering the columns by dates using the SearchBuilder.

Any suggestions?


Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @poeziafree ,

    I think in order to keep the time in data in the table, but filter without that the only way to do this is to create custom conditions. Take a look at the documentation here for how to get started with that.

    SearchBuilder creates DateTime instances using the format that is set for that column so you will need to override that. This is probably fairly simple and just needs the hour and minute tokens to be removed. Beyond that you are going to have to change the conditions search functions for equals and not equals as these won't work properly as is currently.

    Thanks,
    Sandy

Sign In or Register to comment.