From 1afd9958448f0c30ab8340e5a53be2e41ed01c36 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Wed, 3 May 2023 20:04:27 +0200 Subject: [PATCH] Improve token formatting. --- static/galene.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/static/galene.js b/static/galene.js index 88ee1c7..d094f80 100644 --- a/static/galene.js +++ b/static/galene.js @@ -2704,13 +2704,19 @@ function formatToken(token, details) { if(token.group) togroup = ' to group ' + token.group; } + let since = ''; + if(token["not-before"]) + since = ` since ${(new Date(token['not-before'])).toLocaleString()}` /** @type{Date} */ let expires = null; - if(token.expires) - expires = new Date(token.expires); + let until = ''; + if(token.expires) { + expires = new Date(token.expires) + until = ` until ${expires.toLocaleString()}`; + } return [ (expires && (expires >= new Date())) ? - `Invitation${foruser}${togroup}${by} valid until ${expires.toLocaleString()}` : + `Invitation${foruser}${togroup}${by} valid${since}${until}` : `Expired invitation${foruser}${togroup}${by}`, url.toString(), ];