From 1b3b49872319f47fd09e4079e0b2b2970eda856c Mon Sep 17 00:00:00 2001 From: Minz Date: Tue, 3 Feb 2026 10:45:08 +0100 Subject: [PATCH] Core utils: Format date --- core/utils.js | 8 ++++++++ timers/receiptTimer.js | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 core/utils.js diff --git a/core/utils.js b/core/utils.js new file mode 100644 index 0000000..03fb32d --- /dev/null +++ b/core/utils.js @@ -0,0 +1,8 @@ +module.exports = { + formatDate (date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; + } +} diff --git a/timers/receiptTimer.js b/timers/receiptTimer.js index 7c5c5fb..a1bce02 100644 --- a/timers/receiptTimer.js +++ b/timers/receiptTimer.js @@ -10,13 +10,6 @@ module.exports = { async tick(client, timer) { //format date because isostring is utc duh - const formatDate = (date) => { - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); - return `${year}-${month}-${day}`; - }; - try { const today = new Date(); const lastMonday = new Date(today);