Skip to content

Commit

Permalink
updated: all day/time functions now use SI_Symbol method properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Leref committed Jan 24, 2024
1 parent 4604a29 commit 4c86121
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 29 deletions.
16 changes: 11 additions & 5 deletions src/functions/info/date.js
Original file line number Diff line number Diff line change
@@ -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()})
}
}
code: d.util.setCode(data)
};
};
10 changes: 6 additions & 4 deletions src/functions/info/datestamp.js
Original file line number Diff line number Diff line change
@@ -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)
};
}
17 changes: 11 additions & 6 deletions src/functions/info/day.js
Original file line number Diff line number Diff line change
@@ -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()]})
}
}
code: d.util.setCode(data)
};
};
13 changes: 9 additions & 4 deletions src/functions/misc/hour.js
Original file line number Diff line number Diff line change
@@ -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)
}
}
};
};
16 changes: 10 additions & 6 deletions src/functions/misc/month.js
Original file line number Diff line number Diff line change
@@ -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)
}
}
};
};
13 changes: 9 additions & 4 deletions src/functions/misc/year.js
Original file line number Diff line number Diff line change
@@ -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)
}
}
};
};

0 comments on commit 4c86121

Please sign in to comment.