mirror of
https://github.com/arthur-pbty/New-discord-bot-coins.git
synced 2026-06-20 13:50:23 +02:00
add many fonction & add &me command
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
module.exports = function formatDate(timestamp) {
|
||||
const currentDate = new Date();
|
||||
const targetDate = new Date(timestamp);
|
||||
|
||||
const diffTime = Math.abs(targetDate - currentDate);
|
||||
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
||||
const diffHours = Math.floor((diffTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
const diffMinutes = Math.floor((diffTime % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
||||
let result = "";
|
||||
if (diffDays > 0) {
|
||||
result += `${diffDays} jour${diffDays > 1 ? "s" : ""}, `;
|
||||
}
|
||||
if (diffHours > 0) {
|
||||
result += `${diffHours} heure${diffHours > 1 ? "s" : ""} et `;
|
||||
}
|
||||
result += `${diffMinutes} minute${diffMinutes > 1 ? "s" : ""}`;
|
||||
|
||||
return result;
|
||||
};
|
||||
Reference in New Issue
Block a user