date chat ballon date change to commist

This commit is contained in:
Eudes Inácio
2023-09-12 23:15:29 +01:00
parent 86915ee911
commit 9cc97dfc0f
7 changed files with 55 additions and 9 deletions
+2 -1
View File
@@ -39,6 +39,7 @@ function showDateDuration(start) {
}
}
module.exports = {
showDateDuration: showDateDuration,
showDateDuration: showDateDuration
};
+32
View File
@@ -0,0 +1,32 @@
function addZero(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
function showTimeDuration(start) {
let end;
end = new Date();
start = new Date(start);
let customizedDate;
const totalSeconds = Math.floor((end - start) / 1000);
const totalMinutes = Math.floor(totalSeconds / 60);
const totalHours = Math.floor(totalMinutes / 60);
const totalDays = Math.floor(totalHours / 24);
const hours = totalHours - totalDays * 24;
const minutes = totalMinutes - totalDays * 24 * 60 - hours * 60;
const seconds =
totalSeconds - totalDays * 24 * 60 * 60 - hours * 60 * 60 - minutes * 60;
let time = start.getHours() + ":" + addZero(start.getUTCMinutes());
return time;
}
module.exports = {
showTimeDuration: showTimeDuration,
};