1.10.1 has a regression in the date automatic type detection

1.10.1 has a regression in the date automatic type detection

smitty3268smitty3268 Posts: 2Questions: 1Answers: 0
edited July 2014 in Free community support

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

  • smitty3268smitty3268 Posts: 2Questions: 1Answers: 0

    Setting type: 'date' in the columDef fixes it, since it bypasses the automatic detection.

This discussion has been closed.