Add leading zeros to date and time in "Active Leases" table

This commit is contained in:
Alexander Shangin 2023-11-07 13:18:32 +03:00 committed by GitHub
parent 10102a6709
commit a6daf85608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,11 +6,11 @@ var template_render = require('../core/render-template.js');
function human_time (time){
var time = new Date(time);
var year = time.getFullYear();
var month = time.getMonth()+1;
var date1 = time.getDate();
var hour = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();
var month = ("0" + (time.getMonth()+1)).slice(-2);
var date1 = ("0" + time.getDate()).slice(-2);
var hour = ("0" + time.getHours()).slice(-2);
var minutes = ("0" + time.getMinutes()).slice(-2);
var seconds = ("0" + time.getSeconds()).slice(-2);
return year + "-" + month+"-"+date1+" "+hour+":"+minutes+":"+seconds;
}