ui: factor out render_datetime_utc

will be reused in the next patch

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2020-05-26 18:16:38 +02:00
parent 06c3dc8a8e
commit f68ae22cc0
2 changed files with 12 additions and 13 deletions

View File

@ -25,6 +25,17 @@ Ext.define('PBS.Utils', {
return path.indexOf(PBS.Utils.dataStorePrefix) === 0;
},
render_datetime_utc: function(datetime) {
let pad = (number) => number < 10 ? '0' + number : number;
return datetime.getUTCFullYear() +
'-' + pad(datetime.getUTCMonth() + 1) +
'-' + pad(datetime.getUTCDate()) +
'T' + pad(datetime.getUTCHours()) +
':' + pad(datetime.getUTCMinutes()) +
':' + pad(datetime.getUTCSeconds()) +
'Z';
},
render_datastore_worker_id: function(id, what) {
const result = id.match(/^(\S+)_([^_\s]+)_([^_\s]+)$/);
if (result) {