From 55ec020536520005ef54e7a4be3fdf10d7a5d7d1 Mon Sep 17 00:00:00 2001 From: SushiBtw <45533122+SushiBtw@users.noreply.github.com> Date: Sat, 20 Feb 2021 00:57:18 +0100 Subject: [PATCH] fixed % (#8) * let count sols :) * :) * Added percentage * Made 24 hours discord timer to calculate the offset and fix the time * Made 24 hours discord timer to calculate the offset and fix the time * Fixed Sols % --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 384c518..47057ba 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ const julian = require('julian'); const clientId = '811145575134658561'; const day = 24 * 60 * 60; +let marsSol = 88775244; const landingTimestamp = 1613681692; function getMSD(earthTimestamp) { @@ -13,7 +14,7 @@ function getMSD(earthTimestamp) { function getMission() { const date = Date.now(); let sol = Math.floor(getMSD(date) - getMSD(new Date(landingTimestamp * 1000).getTime())); - let percentage = ((getMSD(date) - getMSD(new Date(landingTimestamp * 1000).getTime())) * 100).toFixed(2); + let percentage = ((getMSD(date) - getMSD(new Date(landingTimestamp * 1000).getTime())) * 100 - sol * 100).toFixed(2); let _day = new Date(landingTimestamp * 1000); _day.setDate(_day.getDate() + sol); _day = new Date(_day.getTime() + new Date(day * percentage).getTime());