From 4361d69de393a55ad27574d10d7c6ad62477a13e Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sat, 24 Dec 2022 22:16:52 +0100 Subject: Fix table sort of dates. Fixes . --- assets/js/sort-table.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'assets') diff --git a/assets/js/sort-table.js b/assets/js/sort-table.js index b0f0e62..26fbc49 100644 --- a/assets/js/sort-table.js +++ b/assets/js/sort-table.js @@ -9,6 +9,8 @@ * or http://opensource.org/licenses/MIT * * latest version available at https://github.com/tyleruebele/sort-table + * + * With changes Copyright (c) 2022 Ricardo Wurmus */ /** @@ -173,6 +175,18 @@ sortTable.raw = function(Cell) { return Cell.innerHTML; }; +/** + * Helper function that acts on a sortable data attribute of a table + * cell (TD). + * + * @param Cell A TD DOM object + * @returns {Number} + */ +sortTable.position = function(Cell) { + return Number(Cell.getAttribute('data-js-sort-position')); +}; + + /** * Helper function that converts a table cell (TD) to a comparable value * Captures the last space-delimited token from innerHTML -- cgit v1.2.3