From 2c9e8a8b0b777d6e225ea7b7b756daedb40d2817 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Tue, 3 Jan 2023 21:29:32 +0100 Subject: [PATCH] sort leases by expires --- app/static/assets/js/helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/static/assets/js/helper.js b/app/static/assets/js/helper.js index c4733b9..90f3e8d 100644 --- a/app/static/assets/js/helper.js +++ b/app/static/assets/js/helper.js @@ -70,7 +70,7 @@ async function fetchLeases(element) { ` table.appendChild(thead) let tbody = document.createElement('thead'); - x.forEach((o) => { + x.sort((a, b) => new Date(a.lease_expires) - new Date(b.lease_expires)).forEach((o) => { let row = document.createElement('tr'); row.innerHTML = ` ${o.lease_ref}