From b66378eb0f232a2ef7317552284493e2335288f4 Mon Sep 17 00:00:00 2001 From: Sam Stelle Date: Thu, 20 Feb 2025 19:07:28 -0800 Subject: [PATCH] Add dataset values for date fields in user script table to fix sorting issue for stupid American date format. --- src/UserJS/main.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/UserJS/main.js b/src/UserJS/main.js index ffb8ca4..d2a5228 100644 --- a/src/UserJS/main.js +++ b/src/UserJS/main.js @@ -1393,7 +1393,7 @@ class Container { this.tab.create(this.host); const tabbody = this.tabbody; - const getCellValue = (tr, idx) => tr.children[idx].innerText || tr.children[idx].textContent; + const getCellValue = (tr, idx) => tr.children[idx].dataset.value || tr.children[idx].innerText || tr.children[idx].textContent; const comparer = (idx, asc) => (a, b) => ((v1, v2) => v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) @@ -2613,7 +2613,10 @@ function primaryFN() { textContent: ujs.daily_installs }); const fupdated = make('td', 'mujs-list', { - textContent: language.toDate(ujs.code_updated_at) + textContent: language.toDate(ujs.code_updated_at), + dataset: { + value: (new Date(ujs.code_updated_at)).toISOString() + } }); const fname = make('td', 'mujs-name'); const fmore = make('mujs-column', 'mujs-list hidden', { @@ -2637,7 +2640,10 @@ function primaryFN() { textContent: `${i18n$('version_number')}: ${ujs.version}` }); const fcreated = make('mu-js', 'mujs-list', { - textContent: `${i18n$('created_date')}: ${language.toDate(ujs.created_at)}` + textContent: `${i18n$('created_date')}: ${language.toDate(ujs.created_at)}`, + dataset: { + value: (new Date(ujs.created_at)).toISOString() + } }); const flicense = make('mu-js', 'mujs-list', { title: ujs.license ?? i18n$('no_license'),