1.10.1 has a regression in the date automatic type detection
1.10.1 has a regression in the date automatic type detection
I'm not entirely sure if there is a bug tracker somewhere i can report this.
Looks like the bad commit is here: https://github.com/DataTables/DataTablesSrc/commit/0e5a4d7a663a0a88e12b47d08883a381fca7d1e2
What I'm doing is passing in a raw javascript date object as the column values. With the new code, the _re_date_end.test(d) returns false and it doesn't detect that it's a date anymore. Now it gets parsed as a string column instead, which messes up the sort behavior to be alphabetical instead of chronological.
I'm assuming there is nothing wrong with using an actual date object as the datasource, since it's always seemed to work perfectly. The code in question seems to be assuming only strings are being passed in though.
Confirmed that this fixes it:
change
"if ( d && (! _re_date_start.test(d) || ! _re_date_end.test(d) ) ) {"
line to
"if ( d && !(d instanceof Date) && (! _re_date_start.test(d) || ! _re_date_end.test(d) ) ) {"
Answers
Setting type: 'date' in the columDef fixes it, since it bypasses the automatic detection.