diff --git a/src/functions/info/date.js b/src/functions/info/date.js index 4b00d1d9c..a428f179d 100644 --- a/src/functions/info/date.js +++ b/src/functions/info/date.js @@ -1,7 +1,13 @@ -module.exports = async d => { - const {code} = d.util.aoiFunc(d); +const { FormatOptions } = require("../../utils/Constants"); + +module.exports = (d) => { + const data = d.util.aoiFunc(d); + const date = new Date(new Date().toLocaleString('en-us', { timeZone: d.timezone })); + const formattedOptions = FormatOptions(date); + + data.result = formattedOptions.DD; return { - code: d.util.setCode({function: d.func, code, result: new Date().getDate()}) - } -} \ No newline at end of file + code: d.util.setCode(data) + }; +}; diff --git a/src/functions/info/datestamp.js b/src/functions/info/datestamp.js index c961a9638..5c4c70372 100644 --- a/src/functions/info/datestamp.js +++ b/src/functions/info/datestamp.js @@ -1,7 +1,9 @@ -module.exports = async d => { - const {code} = d.util.aoiFunc(d); +module.exports = (d) => { + const data = d.util.aoiFunc(d); + + data.result = Date.now(); return { - code: d.util.setCode({function: d.func, code, result: Date.now()}) - } + code: d.util.setCode(data) + }; } \ No newline at end of file diff --git a/src/functions/info/day.js b/src/functions/info/day.js index 1f285ab20..b284d8d72 100644 --- a/src/functions/info/day.js +++ b/src/functions/info/day.js @@ -1,8 +1,13 @@ -module.exports = async d => { - const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; - const {code} = d.util.aoiFunc(d); +const {FormatOptions} = require("../../utils/Constants"); + +module.exports = (d) => { + const data = d.util.aoiFunc(d); + const date = new Date(new Date().toLocaleString('en-us', { timeZone: d.timezone })); + const formattedOptions = FormatOptions(date); + + data.result = formattedOptions.dddd; return { - code: d.util.setCode({function: d.func, code, result: days[new Date().getDay()]}) - } -} \ No newline at end of file + code: d.util.setCode(data) + }; +}; diff --git a/src/functions/misc/hour.js b/src/functions/misc/hour.js index 2ada47137..f5038bb6e 100644 --- a/src/functions/misc/hour.js +++ b/src/functions/misc/hour.js @@ -1,8 +1,13 @@ -module.exports = d => { +const {FormatOptions} = require("../../utils/Constants"); + +module.exports = (d) => { const data = d.util.aoiFunc(d); + const date = new Date(new Date().toLocaleString('en-us', { timeZone: d.timezone })); + const formattedOptions = FormatOptions(date); + + data.result = formattedOptions.H; - data.result = new Date(new Date().toLocaleString('en-us', {timeZone: d.timezone})).getHours(); return { code: d.util.setCode(data) - } -} \ No newline at end of file + }; +}; diff --git a/src/functions/misc/month.js b/src/functions/misc/month.js index ac9ef11ed..7f6970024 100644 --- a/src/functions/misc/month.js +++ b/src/functions/misc/month.js @@ -1,9 +1,13 @@ -module.exports = d => { - let data = d.util.aoiFunc(d); - const months = ['january', 'febuary', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'] - data.result = months[new Date(new Date().toLocaleString('en-us', {timeZone: d.timezone})).getMonth()]; +const {FormatOptions} = require("../../utils/Constants"); + +module.exports = (d) => { + const data = d.util.aoiFunc(d); + const date = new Date(new Date().toLocaleString('en-us', { timeZone: d.timezone })); + const formattedOptions = FormatOptions(date); + + data.result = formattedOptions.MMMM; return { code: d.util.setCode(data) - } -} \ No newline at end of file + }; +}; diff --git a/src/functions/misc/year.js b/src/functions/misc/year.js index cee7d2640..1bb6517b4 100644 --- a/src/functions/misc/year.js +++ b/src/functions/misc/year.js @@ -1,8 +1,13 @@ -module.exports = d => { +const {FormatOptions} = require("../../utils/Constants"); + +module.exports = (d) => { const data = d.util.aoiFunc(d); + const date = new Date(new Date().toLocaleString('en-us', { timeZone: d.timezone })); + const formattedOptions = FormatOptions(date); + + data.result = formattedOptions.YYYY; - data.result = new Date(new Date().toLocaleString('en-us', {timeZone: d.timezone})).getFullYear(); return { code: d.util.setCode(data) - } -} \ No newline at end of file + }; +};