Core utils: Format date
This commit is contained in:
8
core/utils.js
Normal file
8
core/utils.js
Normal 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}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,13 +10,6 @@ module.exports = {
|
|||||||
async tick(client, timer) {
|
async tick(client, timer) {
|
||||||
|
|
||||||
//format date because isostring is utc duh
|
//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 {
|
try {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const lastMonday = new Date(today);
|
const lastMonday = new Date(today);
|
||||||
|
|||||||
Reference in New Issue
Block a user