; all the things

This commit is contained in:
Ranlvor 2018-09-02 03:50:02 +02:00
parent 16ac2f0a40
commit 1752ab93e0
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E

View file

@ -149,11 +149,11 @@ const config: Config = {
state: { state: {
name: "/service/ultimaker/job", name: "/service/ultimaker/job",
type: (msg) => { type: (msg) => {
const json = JSON.parse(msg.toString()) const json = JSON.parse(msg.toString());
if(!json || !json["time_elapsed"] || !json["time_total"]) { if(!json || !json["time_elapsed"] || !json["time_total"]) {
return "" return "";
} else { } else {
const secondsLeft = json["time_total"] - json["time_elapsed"] const secondsLeft = json["time_total"] - json["time_elapsed"];
return new Date(secondsLeft * 1000).toISOString().substr(11, 8); return new Date(secondsLeft * 1000).toISOString().substr(11, 8);
} }
} }