Help:Sortable tables: Difference between revisions

Content deleted Content added
Line 1,628:
 
=== Full dates work. Year must be on the end ===
This shows that any full date works ''without'' '''data-sort-type=date''' in the table. Month-day-year or day-month-year. If a number for a day is missing, date sorting is broken. Abbreviated months work too. The year must be on the end., Aand a number can not be used for the month. Either will break date sorting.
 
Sorting works correctly in allthe casesfirst 2 tables below. Years before 100 (for example, year 99) break sorting.
 
|-<div style="display:inline-table; vertical-align:text-top;">
{|
|- style=vertical-align:text-top;
{| class="wikitable sortable"
|-
Line 1,655 ⟶ 1,653:
| 4 Aug 2004
|}
</div>
<div style="display:inline-table; vertical-align:top;">
{| class="wikitable sortable"
|-
Line 1,676 ⟶ 1,675:
| 4 August 2004
|}
</div>
|}
 
'''data-sort-type=date''' in the header for the date column allows sorting to work for all entries not missing a day number. So it is good to add it in case editors forget day numbers for some entries. That can be fixed later. The rest of the dates will sort correctly by date. Test date sorting below. '''Some entries below are missing the day number.''' They end up at the top or bottom of the ''data-sort-type=date'' list upon sorting. The list below without ''data-sort-type=date'' does not sort by date.
 
<div style="display:inline-table; vertical-align:top;">
{| class="wikitable sortable"
|-
! Full dates
|-
| Dec 5, 1999
|-
| Jan 7, 1999
|-
| May 2004
|-
| Aug 4, 2004
|-
| 5 Dec 1999
|-
| 7 Jan 1999
|-
| 14 May 2004
|-
| 4 Aug 2004
|-
| December 1999
|-
| January 7, 1999
|-
| May 14, 2004
|-
| August 4, 2004
|-
| 5 December 1999
|-
| January 1999
|-
| 14 May 2004
|-
| 4 August 2004
|}
</div>
<div style="display:inline-table; vertical-align:top;">
{| class="wikitable sortable"
|-
Line 1,716 ⟶ 1,754:
| 4 August 2004
|}
</div>
 
=== Year, month, day. Using words for months ===