Bug 9061

Summary: DataTables date sort does not work with date in uk format (dd/mm/yyyy)
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P5 - low CC: dcook, jonathan.druart, melia
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 9061 - DataTables date sort does not work with date in uk format (dd/mm/yyyy)
[Signed off] Bug 9061 - DataTables date sort does not work with date in uk format (dd/mm/yyyy)

Description Owen Leonard 2012-11-12 13:32:23 UTC
With the older tablesorter plugin you could specify the UK date format:

$("#issuest").tablesorter({[% IF ( dateformat_metric ) %]
		dateFormat: 'uk',[% END %]...

It doesn't look like DataTables has this option built in.
Comment 1 Owen Leonard 2012-11-16 17:12:30 UTC Comment hidden (obsolete)
Comment 2 Melia Meggs 2012-11-16 19:03:41 UTC
Created attachment 13494 [details] [review]
[Signed off] Bug 9061 - DataTables date sort does not work with date in uk format (dd/mm/yyyy)

The DataTables plugin doesn't include native support for sorting date
in uk/euro format (dd/mm/yyyy). This patch adds a plugin to be
optionally included in cases where the Koha dateformat preference
is set to "metric."

The patron circulation history page is the only page affected by this
patch. If it is found to be working well I will submit follow-ups
to cover other instances where sorting by date occurs.

To test, load the patron circulation history page (members/readingrec.pl)
for a patron with a circulation history. Sorting by "date," "checked out
on," "date due," and "Return date" should work correctly with under
all three dateformat settings.

Signed-off-by: Melia Meggs <melia@test.bywatersolutions.com>
Comment 3 Melia Meggs 2012-11-16 19:08:39 UTC
To test, I set dateformat to dd/mm/yyyy.

Before applying patch, the patron's circulation history showed in this date order:
12/03/2012 (March 12, 2012)
13/09/2012 (September 13, 2012)
14/06/2012 (June 14, 2012)

After applying the patch, the patron's circulation history was correctly ordered by date.  I also checked that "checked out on," "date due," and "return date" all sort in correct date order as well.
Comment 4 Jonathan Druart 2012-11-19 09:39:35 UTC
Hi Owen,

Your patch works. 

But do you know a (quite) similar function already exist (dt_add_type_uk_date in js/datatables.js)? (see booksellers.tt and aqbugetperiods.tt for example).
This function does not handle hours in date but maybe we could regroup both functions (file, function name, etc.)?
Comment 5 David Cook 2014-02-26 00:45:57 UTC
Why has this been marked as resolved invalid?

It seems to me like this is still something that is needed...
Comment 6 David Cook 2014-02-26 00:49:43 UTC
(In reply to David Cook from comment #5)
> Why has this been marked as resolved invalid?
> 
> It seems to me like this is still something that is needed...

Nevermind. Answered my own question:

Bug 9108