Core utils: Format date

This commit is contained in:
2026-02-03 10:45:08 +01:00
parent 6fabb20a2c
commit 1b3b498723
2 changed files with 8 additions and 7 deletions

8
core/utils.js Normal file
View File

@@ -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}`;
}
}

View File

@@ -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);