warframe-worldstate-parser icon indicating copy to clipboard operation
warframe-worldstate-parser copied to clipboard

Worldstate times incorrect?

Open rhit-villencr opened this issue 1 year ago • 3 comments

When I am grabbing the data for, say, cambionCycle. It seems the timeleft value is incorrect. I may be doing something incorrectly though.

Screenshot 2024-02-25 145403

for further context, this is how I am using the API generally:

Screenshot 2024-02-25 145403

rhit-villencr avatar Feb 25 '24 19:02 rhit-villencr

That definitely looks wrong.

You should update your node version if you're using request-promise. The fetch API is part of the default node API, and we expose this data on https://api.warframestat.us, docs: https://docs.warframestat.us.

I can't say what's up with the times on your particular system, as it seems like there's be several variables at play that I can't account for on your system. Thus why we made the rest API

TobiTenno avatar Feb 26 '24 03:02 TobiTenno

Using the parser, it seems that everything but Cetus and Cambion Drift looks good. I just updated my version of node to the newest version. How would you recommend I implement the rest API as I am not super fluent in anything js. It also looks like times are fine on my system.

Screenshot of data grabbed from API: Screenshot 2024-02-25 224417

For further even context: This is how the fetchData() function above is called and used:

Screenshot 2024-02-25 224417

rhit-villencr avatar Feb 26 '24 03:02 rhit-villencr

replace whatever you had in fetchData with

fetch('https://api.warframestat.us/pc/?language=en').then((d) => d.json())

the above part would simplify down to....

const ws = await fetch('https://api.warframestat.us/pc/?language=en').then((d) => d.json());
const { cetusCyle: cc } = ws;
returnValue = `Cetus is currently in ${cc.state}\nTime remaining until ${cc.isDay ? 'night' : 'day'}: ${cc.timeLeft}`;

that said, i don't recommend using timeLeft in general, because it's generated when the object is generated, either way, so it's not a good way to get the timestamp, you'd be better off using moment to make a "from" timestamp, or one of the various "fromX" utilities in warframe-worldstate-data, like get the diff you need and then pass it into... https://github.com/WFCD/warframe-worldstate-data/blob/master/tools/timeDate.js#L19

TobiTenno avatar Feb 26 '24 15:02 TobiTenno