thejosejorge / futcal-for-scriptable

Futcal is a football widget for Scriptable.
76 stars 25 forks source link

Widget Date/Time broken #24

Closed seanob86 closed 3 years ago

seanob86 commented 3 years ago

Date/Time represented as 01/Jan NaN:NaN in widget

5869E24E-FDF6-4EAD-98A7-DC393BBB28C5

thejosejorge commented 3 years ago

Hi @seanob86,

Thanks for reporting this. Unfortunately I am not able to reproduce, I am getting the correct time and date on my widget:

Can you add the following on row 201 (immediately after we get the matchDetails) and share the log information? It seems the time and date information is not being properly retrieved. 201 console.log(matchDetails.content.matchFacts.infoBox["Match Date"])

In the end it should look like: 200 const matchDetails = await getData(matchDetailsUrl, matchDetailsOffline); 201 console.log(matchDetails.content.matchFacts.infoBox["Match Date"])

Thanks, Jose

seanob86 commented 3 years ago

Monday, April 12 2021, 5:00 a.m. Saturday, April 17 2021, 6:00 a.m.

I also copied the script off GitHub and without making any changes I still get the issue.

thejosejorge commented 3 years ago

Hi @seanob86,

Thanks for the quick feedback! So that's the problem, for some reason the string format in the API changed and it's causing the date/time to break since "a.m."/"p.m." is not an expected format. I am not seeing this new format (and therefore not reproducing the issue) probably because we are in different time zones. (I assume you are not in the UK since the time for the next Man United match is 6am)

I can make a change to fix this but in order to understand the best way to do it can you please also add the following to the script (immediately after what we previously added) and share the log information? console.log(match.status.startDateStr) console.log(match.status.startTimeStr)

Thanks, Jose

seanob86 commented 3 years ago

Friday, April 16 2021, 5:00 a.m. Fri, 16 Apr undefined Monday, April 19 2021, 1:00 a.m. Mon, 19 Apr 01:00

it’s actually 1AM for my local time zone. It was 6AM for the default settings when I recopied the script off GitHub. My time zone setting

timeZone: "Australia/Melbourne",

thejosejorge commented 3 years ago

Can you please try again with the latest version?

Apparently FotMob is changing their API structure / data so the widget needs to be adapted to these changes.

seanob86 commented 3 years ago

Thank you! It's now working with latest version 👍

thejosejorge commented 3 years ago

Closed.

seanob86 commented 2 years ago

Hey @thejosejorge its me again. just noticed I’m having issues again with time as NaN:NaN for next match.

I copied the code again and running the code as is works. But as soon as I change team to manutd and Timezone to “Australia/Melbourne” the issue can be seen.

9ABC1249-8BDF-4087-81D7-926395F9D79E