Bug 18396

Summary: UK format dates not sorting correctly
Product: Koha Reporter: David Roberts <david.roberts>
Component: Staff interfaceAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: gmcharlt, r.delahunty
Version: 16.05   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Screenshot showing UK date sorting problem

Description David Roberts 2017-04-06 22:56:47 UTC
Created attachment 61956 [details]
Screenshot showing UK date sorting problem

When you view a user with a large number of checkouts, and you sort the checkouts by date issued, if the system uses UK date format (DD/MM/YYYY) the sorting doesn't working correctly - for example, you might see:

02/02/2017
03/03/2017
08/02/2017
10/01/2017
16/12/2016

instead of the correct order, which would be:

16/12/2016
10/01/2017
02/02/2017
08/02/2017
03/03/2017

See attached screenshot for a real example.
Comment 1 Owen Leonard 2017-04-07 14:54:46 UTC
My favorite method of avoiding date parsing nightmares when sorting is to use the "title-string" option for DataTables.

\koha-tmpl\intranet-tmpl\prog\en\modules\admin\currency.tt:

   30              "columnDefs": [
   31                  { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
   32:                 { "sType": "title-string", "aTargets" : [ "title-string" ] }
   33                  ],
   34          }, columns_settings );

   ..

  208              <th>Symbol</th>
  209              <th>ISO code</th>
  210:             <th class="title-string">Last updated</th>
  211              <th>Active</th>
  212              <th>Archived</th>

   .. 

  223    <td><span title="[% currency.timestamp %]">[% currency.timestamp | $KohaDates %]</span></td>

I don't know if that solution would work with the checkouts table.
Comment 2 Katrin Fischer 2019-01-14 20:35:13 UTC
The checkouts table checkout date sorting issue was fixed by bug 21562.

*** This bug has been marked as a duplicate of bug 21562 ***