estiens / world_cup_json

Rails backend for a scraper that outputs World Cup data as JSON
928 stars 107 forks source link

What is the server's timezone? #229

Closed CyrilNb closed 1 year ago

CyrilNb commented 1 year ago

A user of my project noticed me that the today's matches did not match his real day (he's living in Mexico). I am based in Europe so I did not catch the problem before as I saw that the /today endpoint is refreshing at 1am for me (Paris time). But I did not think about other timezone.

How is this handle internally?

yasincandev commented 1 year ago

you can use dayjs for that https://day.js.org/docs/en/installation/node-js

you can write like:

 dayjs(match.datetime).format("hh:mm A")}
CyrilNb commented 1 year ago

this is not relevant with the question I am asking

estiens commented 1 year ago

today uses UTC, but you can pass specific date params as well