Issue with date range filter and date format DD.MM.YYYY

Issue with date range filter and date format DD.MM.YYYY

medarobmedarob Posts: 23Questions: 7Answers: 0

This is a similar issue like this one:
https://datatables.net/forums/discussion/71488/issue-with-datatables-date-range-filter

I have a date input field with the DD.MM.YYYY format (code is similar to this one: https://live.datatables.net/topuhayo/6/edit) and when I select a startdate, for example 27.07.2025 then rows with this date are not shown anymore.

I took the updated and working example (http://live.datatables.net/polaloto/1/edit) from the discussion above and changed the date format to DD.MM.YYYY in the hope it might work.

Here is my final example: https://live.datatables.net/pezepase/1/edit

However, selecting the startdate (or enddate) doesn't change the table. It seems that it won't be filtered.
What am I missing?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 22,200Questions: 26Answers: 5,111
    Answer ✓

    There were a couple issues. First you are loading datatables.js and its extensions multiple times. This will cause issues where functions might not use the same instance of datatables.js. I chose the first one you had loaded.

    The other problem is it looks like you are mixing comparing moment.js dates (data within the table) with Javescript Date() dates fetched from the inputs. I changed to use moment.js for all dates.

    https://live.datatables.net/pezepase/2/edit

    Kevin

  • medarobmedarob Posts: 23Questions: 7Answers: 0

    Thank you. :)
    The comparison change worked.

Sign In or Register to comment.