drvic10k / bootstrap-sortable

adding sorting ability to bootstrap table
MIT License
513 stars 131 forks source link

Issue sorting date with time #77

Closed KrunchMuffin closed 8 years ago

KrunchMuffin commented 8 years ago

Is this even supported?

I have moment.js and my TH is like this

<th data-dateformat="MM/DD/YYYY h:mmA">Date Submitted</th> and a sample TD <td>06/11/2016 11:00AM</td>

you can see it doesn't sort properly image

KrunchMuffin commented 8 years ago

I think I may have it resolved. I added data-value="2015-12-09 11:00AM" to each TD and changed the dateformat to match and seems to sort ok. Must be the slash messing it up?

KrunchMuffin commented 8 years ago

Think I spoke too soon. Not sorting times

image <th class="up sorted" data-sortcolumn="2" data-sortkey="2-0" data-dateformat="YYYY-MM-DD h:mmA">Trans. Date<span class="sign arrow up"></span></th> <td class="sorted" data-value="2015-12-09 9:21AM">12/09/2015 9:21 AM</td>

KrunchMuffin commented 8 years ago

nevermind. I am a tool. was putting dateformat on the TH not TD. be nice to be able to just have it on the TH tho.

drvic10k commented 8 years ago

I'm glad you solved it

Anyway, it's a good idea to have possibility to specify the format in header instead of each cell separately

KrunchMuffin commented 8 years ago

cool.