From 6b073dd5fc5e940b449b080776e85b580a8117b0 Mon Sep 17 00:00:00 2001 From: Exiom Date: Fri, 21 Aug 2020 03:33:35 +0000 Subject: [PATCH 1/2] Fix Date/Time Month Ordering #1234 --- .../templates/groupmanagement/audit.html | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/allianceauth/groupmanagement/templates/groupmanagement/audit.html b/allianceauth/groupmanagement/templates/groupmanagement/audit.html index 79fda99d..470cd39f 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/audit.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/audit.html @@ -33,7 +33,7 @@ {% for entry in entries %} - {{ entry.date|date:"Y-m-d H:i" }} + {{ entry.date|date:"Y-M-d, H:i" }} {{ entry.requestor }} {{ entry.req_char }} {{ entry.req_char.corporation_name }} @@ -66,6 +66,7 @@ {% block extra_javascript %} {% include 'bundles/datatables-js.html' %} + {% include 'bundles/moment-js.html' %} {% endblock %} @@ -74,9 +75,28 @@ {% endblock %} {% block extra_script %} + + $.fn.dataTable.moment = function ( format, locale ) { + var types = $.fn.dataTable.ext.type; + + // Add type detection + types.detect.unshift( function ( d ) { + return moment( d, format, locale, true ).isValid() ? + 'moment-'+format : + null; + } ); + + // Add sorting method - use an integer for the sorting + types.order[ 'moment-'+format+'-pre' ] = function ( d ) { + return moment( d, format, locale, true ).unix(); + }; + }; + $(document).ready(function(){ + $.fn.dataTable.moment( 'YYYY-MMM-D, HH:mm' ); + $('#log-entries').DataTable({ - order: [[ 0, 'desc' ], [ 1, 'asc' ] ], + order: [[ 0, 'desc' ]], filterDropDown: { columns: [ From 64251b9b3c51c6c7066eb35fc402ad42cd9ee153 Mon Sep 17 00:00:00 2001 From: Exiom Date: Fri, 21 Aug 2020 03:57:24 +0000 Subject: [PATCH 2/2] Fix Date/Time Month Ordering #1234 --- .../groupmanagement/templates/groupmanagement/audit.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allianceauth/groupmanagement/templates/groupmanagement/audit.html b/allianceauth/groupmanagement/templates/groupmanagement/audit.html index 470cd39f..39812715 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/audit.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/audit.html @@ -96,7 +96,7 @@ $.fn.dataTable.moment( 'YYYY-MMM-D, HH:mm' ); $('#log-entries').DataTable({ - order: [[ 0, 'desc' ]], + order: [[ 0, 'desc' ], [ 1, 'asc' ] ], filterDropDown: { columns: [