feat: Standard time conversion
This commit is contained in:
parent
fa46a7f1c5
commit
a9d67eb0bf
1 changed files with 18 additions and 0 deletions
18
scripts/timeprocessor.js
Normal file
18
scripts/timeprocessor.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
/* Process the conversion of times. */
|
||||||
|
class TimeProcessor {
|
||||||
|
static convert(DATE) {
|
||||||
|
try {
|
||||||
|
DATE = (DATE != null && isNaN(Number(DATE))) ? DATE : Number(DATE);
|
||||||
|
|
||||||
|
let TIME = new Date(DATE);
|
||||||
|
if (TIME == "Invalid Date") {throw EvalError};
|
||||||
|
|
||||||
|
return ({"unix": TIME.getTime(), "utc": TIME.toUTCString()});
|
||||||
|
} catch(err) {
|
||||||
|
throw(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {TimeProcessor};
|
Loading…
Add table
Add a link
Reference in a new issue