Unable to find an exact date using FixedColumns component and calendar with data in DateTime format

Unable to find an exact date using FixedColumns component and calendar with data in DateTime format

sloloslolo Posts: 132Questions: 27Answers: 2

Link to test case: https://live.datatables.net/nilaciqu/1/edit
Debugger code (debug.datatables.net): NA
Error messages shown: NA
Description of problem: Hello,

Hello,

I'm having a small problem using the FixedColumns component with dates in ISO 8601 format.

In a test case, searching for a specific date doesn't work.

However, sorting is functional, and I can search for dates before or after. Only the exact date doesn't work.

Just to clarify, my regional settings are in French.

Ex. Sorting on date: OK

Ex. Filtering on a later date: OK

Ex. Filtering on a exact date: KO

However, the date 2025-11-09 does exist in the table.

Just to clarify, I don't use Moment.js or Luxon.

Thanks in advance for your help and have a nice day.

Lolo

Answers

  • kthorngrenkthorngren Posts: 22,458Questions: 26Answers: 5,166

    Take a look at this example of how to set ColumnControl to search only the date when both the date and time are supplied. Updated test case:
    https://live.datatables.net/nilaciqu/2/edit

    Kevin

  • sloloslolo Posts: 132Questions: 27Answers: 2

    Hello @kthorngren,

    Thanks for your answer.

    If I modify your test case with mask: 'DD/MM/YYYY', instead of mask: 'MM/DD/YYYY', (for French display), here is what I have:

    Really strange, isn't it?

    See: https://live.datatables.net/nilaciqu/3/edit

  • allanallan Posts: 65,716Questions: 1Answers: 10,929 Site admin

    mask should be in ISO8601 format, as noted in the docs.

    That said, I suspect you are running afoul of a time zone error if you aren't in UTC yourself. I need to find some time to look into that more.

    Allan

  • sloloslolo Posts: 132Questions: 27Answers: 2

    Hi @allan,

    mask should be in ISO8601 format, as noted in the docs.

    I have just done what @kthorngren told me ;)

    However, I can't get my test case to work. Are you using moments.js to make the search work?

    And if I try to use "format" in the options, I get the following error message:

    "Uncaught DateTime: Without momentjs, dayjs or luxon only the format 'YYYY-MM-DD' can be used (line 14)"

    For information, here is my regional settings:

  • sloloslolo Posts: 132Questions: 27Answers: 2

    Sorry to bring up this old post. I'm still looking for a solution, actually.

    As a reminder, I can't filter by a specific date.

    Oddly enough, the "Before" and "After" filters work fine. Only the "Equal" and "Does not equal" filters don't work.

    Before and After are OK:

    But "Equal" and "Not equal" are KO:

    I have updated my test case with the latest versions of the DataTables component.

    https://live.datatables.net/difuwoxi/1/edit

    A quick reminder of my setup:

    I'm running Windows 10 22H2
    Chrome 145.0.7632.160
    And the system dates are in French, as mentioned in the screenshots earlier in the post.

    Any idea please?

    Thanks in advance and have a nice day.

  • sloloslolo Posts: 132Questions: 27Answers: 2

    Hello,

    I have done some videos in order to help you to see my problems.

    Link to the test case I used to make videos:
    https://live.datatables.net/yohejuyo/1/edit

    Links for videos are available below:

    **Problem with Luxon library:
    **https://streamable.com/ck46r7

    **Problem with date rendering and column control filter:
    **https://streamable.com/une0dh

    Could you please provide an example using the CommonControl component that works with dates in the format YYYY-MM-DD or yyyy-MM-ddTHH:mm:ssZ (internally) and displays them in the DataTable in the format DD/MM/YYYY?

  • sloloslolo Posts: 132Questions: 27Answers: 2

    Hello,

    I have updated and simplified my test case with the last version of DataTables v2.3.8
    cf. https://live.datatables.net/pugoxepa/1/

    As you can see on the video, I am not able to find a specific date (I am on French Windows 10 22H2 and Google Chrome 147.0.7727.138 (Build officiel) (64 bits).

    If I comment the line render: DataTable.render.date() in columnDefs definition, the date is displayed in English BUT the search works.

    You can see the behavior in video here: https://streamable.com/g7ttq4

    Do you think I have to try to use MomentJS or Luxon libraries?

    Thanks in advance for your help.

  • allanallan Posts: 65,716Questions: 1Answers: 10,929 Site admin

    Hi,

    Sorry for the delay in replying here. It looks like there are a few issues - the first is type: 'date' - that should be removed and allow DataTables to auto detect the date type.

    However, even without that, there is an error as it isn't correctly detected the formatted date type. This is something I'm going to need to set a little bit of time aside at some point to debug I'm afraid. The test case is very useful for that - thank you. I'm not certain when I'll be able to debug it yet as I'm deep in the middle of some other changes at the moment, but I will try to do so as soon as I can.

    Allan

Sign In or Register to comment.