thejosejorge / futcal-for-scriptable

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

undefined is not an object #44

Open hangoon-p opened 1 year ago

hangoon-p commented 1 year ago

Now Futcal is not working since Fotmob API has slightly changed. To fix it, you need to follow below steps.

  1. Find the code to modify at around Line 299.

               const detailsDateValue = formatDate(new Date((matchDetails.content.matchFacts.infoBox["Match Date"].dateFormatted).replaceAll(".", "")));
                addFormattedText(matchInfoDetailsStack, detailsDateValue, Font.regularSystemFont(12), Color.gray(), null, false);
                matchInfoDetailsStack.addSpacer(3);
                const detailsTimeValue = formatTime(new Date((`${matchDetails.content.matchFacts.infoBox["Match Date"].dateFormatted} ${matchDetails.content.matchFacts.infoBox["Match Date"].timeFormatted}`).replaceAll(".", "")));
  2. Replace it to below

                const detailsDateValue = formatDate(new Date((matchDetails.content.matchFacts.infoBox["Match Date"].utcTime)));
                addFormattedText(matchInfoDetailsStack, detailsDateValue, Font.regularSystemFont(12), Color.gray(), null, false);
                matchInfoDetailsStack.addSpacer(3);
                const detailsTimeValue = formatTime(new Date((`${matchDetails.content.matchFacts.infoBox["Match Date"].utcTime}`)));

There's nothing difficult. It's just analyzing returned JSON data.

@beratgashi

beratgashi commented 1 year ago

Thank you @hangoon-p it worked perfectly I don't know where are you checking this codes to find the fix this fast!

Thank you very much man 🔥

beratgashi commented 1 year ago

I think that the api changed slightly again! @hangoon-p

hangoon-p commented 1 year ago

I think that the api changed slightly again! @hangoon-p

Hello @beratgashi After your message I have observed but mine is Okay until now. If you are having a trouble, I recommend you to re-install the script.

beratgashi commented 1 year ago

Hey @hangoon-p, yes you're right it was fixed for me too after some days!

Thanks for your reply ☺️