forked from Hri7566/mpp-server-dev2
these things
This commit is contained in:
parent
be121478b3
commit
eafca18a05
|
@ -0,0 +1,3 @@
|
||||||
|
const ColorEncoder = require("./src/ColorEncoder");
|
||||||
|
|
||||||
|
console.log(ColorEncoder.getTimeColor(new Date("Dec 30 1970")).toHexa());
|
|
@ -58,6 +58,9 @@ function getTimeColor(currentDate = new Date()) {
|
||||||
let differenceInTime = (currentDate - newYearsDay) + ((newYearsDay.getTimezoneOffset() - currentDate.getTimezoneOffset()) * 60 * 1000);
|
let differenceInTime = (currentDate - newYearsDay) + ((newYearsDay.getTimezoneOffset() - currentDate.getTimezoneOffset()) * 60 * 1000);
|
||||||
let oneDayInMS = 1000 * 60 * 60 * 24;
|
let oneDayInMS = 1000 * 60 * 60 * 24;
|
||||||
let dayOfYear = Math.ceil(differenceInTime / oneDayInMS);
|
let dayOfYear = Math.ceil(differenceInTime / oneDayInMS);
|
||||||
|
dayOfYear %= 365;
|
||||||
|
|
||||||
|
console.log(dayOfYear);
|
||||||
|
|
||||||
// get hour
|
// get hour
|
||||||
let hours = currentDate.getHours();
|
let hours = currentDate.getHours();
|
||||||
|
|
Loading…
Reference in New Issue