From a1986c12a2e24463a205fbecadaeabc1d6314bfc Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Mon, 28 Jun 2021 17:54:22 +0200 Subject: [PATCH] Add convertDateToISOString.js Also make getCreationDate.js and getJoinDate.js use this function --- util/convertDateToISOString.js | 3 +++ util/getCreationDate.js | 3 ++- util/getJoinDate.js | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 util/convertDateToISOString.js diff --git a/util/convertDateToISOString.js b/util/convertDateToISOString.js new file mode 100644 index 0000000..764c279 --- /dev/null +++ b/util/convertDateToISOString.js @@ -0,0 +1,3 @@ +module.exports = function (date){ + return date.getUTCFullYear() + '-' + ('0' + (date.getUTCMonth()+1)).slice(-2) + '-' + ('0' + date.getUTCDate()).slice(-2)+" "+date.getUTCHours()+":"+date.getUTCMinutes()+":"+date.getUTCSeconds(); +} \ No newline at end of file diff --git a/util/getCreationDate.js b/util/getCreationDate.js index 2bb9472..fa15199 100644 --- a/util/getCreationDate.js +++ b/util/getCreationDate.js @@ -1,4 +1,5 @@ +const convertDateToISOString = require("./convertDateToISOString"); module.exports = function(user){ let date = user.user.createdAt; - return date.getUTCFullYear() + '-' + ('0' + (date.getUTCMonth()+1)).slice(-2) + '-' + ('0' + date.getUTCDate()).slice(-2)+" "+date.getUTCHours()+":"+date.getUTCMinutes()+":"+date.getUTCSeconds(); + return convertDateToISOString(date); } \ No newline at end of file diff --git a/util/getJoinDate.js b/util/getJoinDate.js index e61a3ea..20cfc32 100644 --- a/util/getJoinDate.js +++ b/util/getJoinDate.js @@ -1,5 +1,6 @@ +const convertDateToISOString = require("./convertDateToISOString"); module.exports = function(user, guild){ const member = guild.member(user) let date = member.joinedAt; - return date.getUTCFullYear() + '-' + ('0' + (date.getUTCMonth()+1)).slice(-2) + '-' + ('0' + date.getUTCDate()).slice(-2)+" "+date.getUTCHours()+":"+date.getUTCMinutes()+":"+date.getUTCSeconds(); + return convertDateToISOString(date) } \ No newline at end of file