diff --git a/frontend/src/components/admin/users/UserInfo.svelte b/frontend/src/components/admin/users/UserInfo.svelte index af00c1c6..a663b751 100644 --- a/frontend/src/components/admin/users/UserInfo.svelte +++ b/frontend/src/components/admin/users/UserInfo.svelte @@ -26,7 +26,7 @@ let timer; let language = user.language.toUpperCase(); let limitLifetime = !!user.user_expires; - let userExpires = limitLifetime ? formatDateToDateInput(new Date(user.user_expires * 1000)) : undefined; + let userExpires = limitLifetime ? formatDateFromTs(user.user_expires, true) : undefined; let allRoles = []; globalRolesNames.subscribe(rls => { diff --git a/frontend/src/utils/helpers.js b/frontend/src/utils/helpers.js index 4810bde8..ff791cec 100644 --- a/frontend/src/utils/helpers.js +++ b/frontend/src/utils/helpers.js @@ -148,11 +148,10 @@ export const formatUtcTsFromDateInput = inputDate => { if (isNaN(d)) { return; } - const tzDiff = -new Date().getTimezoneOffset() * 60; - return d / 1000 + tzDiff; + return d / 1000; } -export const formatDateFromTs = ts => { +export const formatDateFromTs = (ts, fmtIso) => { const utcOffsetMinutes = -new Date().getTimezoneOffset(); const d = new Date((ts + utcOffsetMinutes * 60) * 1000); @@ -179,6 +178,9 @@ export const formatDateFromTs = ts => { sc = '0' + sc; } + if (fmtIso) { + return `${yyyy}-${mm}-${dd}T${hr}:${mn}:${sc}`; + } return `${yyyy}/${mm}/${dd} ${hr}:${mn}:${sc}`; }