I’ve searched in FAQ and Documentation (including DataTables Sorting plugin) and I didn’t find a proper way to handle this particular issue.
The problem is that my client is very demanding and specifically requires the following date format: DD.MM. – DD.MM.YYYY in case of events lasting longer than 1 day and DD.MM.YYYY in case of 1-day events. Unfortunately, sorting goes south, obviously.
I thought maybe there is a way to sort using different columnn than actually clicked? Specifically, let’s make a column with above-mentioned date format and next to it another, hidden, column with YYYY-MM-DD for example. Clicking on the first column’s header would actually invoke sorting on the hidden column – is that even possible? This is not an ideal solution, since every new event would require entering both date formats, but it’s better than nothing. Sorting on YYYY-MM-DD works flawlessly. Even if we somehow told the Tablepress to sort basing on the first five characters being “DD.MM”, it would break at year. 2014 would be among 2013s, etc. It HAS TO (sigh) be sorted by the first (or the only in some cases) day of an event, not the last, and the first day doesn’t have a year attached.
Is there some quirky regex-like way to handle that?
Does anyone have a solution?
- The topic ‘Sorting a column with a custom date format’ is closed to new replies.