willianjusten / nba-nextjs

See NBA game results and standings powered by Next.js
https://nba.willianjusten.com.br
26 stars 2 forks source link

Something is wrong with the dates #33

Open tiagosoares94 opened 4 months ago

tiagosoares94 commented 4 months ago

Hello! I've loved your project. nba.com/games is so bad.

About the error:

When you access the homepage, it shows the previous day's games, but with today's date.

To see today's games, you have to change the date, and then return to it via the calendar.

mvfsillva commented 4 months ago

Hey @tiagosoares94 I'm glad you're enjoying the project!

I attempted to replicate the error but couldn't encounter the issue.

Here are the steps I followed:

  1. Opened the homepage and checked the games.
  2. Clicked on the right arrow to proceed to the next day.
  3. Checked the games again.
  4. Clicked on the left arrow to return to "today."
  5. Checked the games once more.

Browser:

Could you please share which browser and version you are using? Also, if possible, could you provide the steps to reproduce the issue?

Thanks

willianjusten commented 4 months ago

I've seen this error already. Actually it happens during the mornings.

What happens is that the API that we get the today values updates during the day, so until they update to the next day, it displays the data from the previous day.

I was going to analyze more about this, but life got in the way...

I'll try to analyze this weekend to fix, probably it's just matter of updating the getDays function to get the day with a timezone or minus some hours (to be the same as the API).

If you go to the official site during the morning (Brazilian time) you'll see it displaying the games from a day before too. If we just mimick that, would be fine.

https://www.nba.com/games