More flexible US-style datetime sorting plugin

More flexible US-style datetime sorting plugin

voodoovoodoo Posts: 4Questions: 1Answers: 0
edited April 2014 in Plug-ins
I'm not sure how (or if!) you like to hear about user-created plug-ins, but I made a new version of the datetime-us data sorting that offers a little more flexibility than the existing one.

See it here:
https://gist.github.com/mark47/10427687

In addition to the current datetime-us, it handles:

- Sorts non-date values go to bottom of list on descending (they are counted as older than any date). My tables some have "none" instead of an actual date in that column.
- Time is optional.
- am/pm is optional along with whether there's a space between the time and the am/pm.

Replies

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin
    Very nice! Perhaps you could send it as a pull request to the plug-ins repo: https://github.com/DataTables/Plugins/tree/master/sorting ? That would be awesome.

    If it does everything the current plug-in does, and more, it might be worth just updating the existing plug-in rather than creating a new one.

    Thanks,
    Allan
  • voodoovoodoo Posts: 4Questions: 1Answers: 0

    Realized I never responded to this. I just checked in my code and made a pull request in the plug-ins repo. Let me know if I missed anything.

  • RajanBajaniaRajanBajania Posts: 1Questions: 0Answers: 0

    I need to sort Date and then time
    but it seems this plugin doesn't work in that way it and sorts only date.

    I have date time Format like this : "11/07/2014 4:54PM" and I need to sort it first On date and then on time.

This discussion has been closed.