summaryrefslogtreecommitdiff
path: root/assets/js/sort-table.js
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2022-12-24 22:16:52 +0100
committerRicardo Wurmus <rekado@elephly.net>2022-12-24 22:16:52 +0100
commit4361d69de393a55ad27574d10d7c6ad62477a13e (patch)
tree154d19d02a2bb258eafde7bb106d48d3f956d65d /assets/js/sort-table.js
parent53b930002b82d3103482f4c9080b2a89d0f4fa14 (diff)
Fix table sort of dates.
Fixes <https://issues.guix.gnu.org/47739>.
Diffstat (limited to 'assets/js/sort-table.js')
-rw-r--r--assets/js/sort-table.js14
1 files changed, 14 insertions, 0 deletions
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
*/
/**
@@ -174,6 +176,18 @@ sortTable.raw = function(Cell) {
};
/**
+ * 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
*