Sort date/time with empty values

Sort date/time with empty values

typhontyphon Posts: 25Questions: 7Answers: 0

Hello,

I'm using 2 colums contains localized date and time (e.g.: de: 21.07.2016, 00:00; en: 07/21/2016 12:00 AM).

With moment it works as long values are present ( $.fn.dataTable.moment('L, LT'); ) , But if no value present (in my case I print only a - (minus)) the sorting doesn't work. If I remove the '-' and pring an empty "" it works as expected.

Is there a way to sort this constellation with the '-' on start or end it doesn't matter?

thx and br

Replies

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    Hi,

    You'd need to modify the plug-in slightly to allow for the - on its own. Specifically here (just add an || d === '-') and here (same again!).

    Regards,
    Allan

  • typhontyphon Posts: 25Questions: 7Answers: 0

    Thx a lot, works perfectly!

This discussion has been closed.