Androz2091 / discord-data-package-explorer

🌀 What's really in your Discord Data package?
https://ddpe.androz2091.fr
GNU General Public License v3.0
822 stars 77 forks source link

How is timezone for "discord hours" adjusted? #69

Open 5HT2 opened 1 year ago

5HT2 commented 1 year ago

I spend a lot of time across various timezones, how is the discord hours count adjusted / calculated, and what timezone does it display in?

Androz2091 commented 1 year ago

hello, it uses your current timezone to display the result.

If you spend 6 hours in the night in Canada and go to France to view your stats, you will see that all these 6 hours are spent within the day. This can probably be handled in a better way

5HT2 commented 1 year ago

Hmn. The activity/reporting/events-20XX-00000-of-00001.json includes "time_zone": "America/Toronto" in JSON.

I'm not sure how you're currently processing the "discord hours" graph but you'd be able to get the timezone for each message, and adjust the timestamp to the timezone that the message was sent in.

For example, if I send 3 messages at 4am in America/Toronto, and 1 message in Europe/London at 9am, they would all count as 4 messages at 9am in Etc/UTC.

And then you can shift 9am forwards or backwards depending on the browser's local timezone.

TLDR: When increasing the message count for an hour of the day, convert from the message's timezone hour of day to Etc/UTC hour of day, and then display in local timezone.

5HT2 commented 1 year ago

I do understand that most users probably won't care too much about this, but I'd greatly appreciate support for it (or if you point me to where in the code the hours are calculated I can add it myself), as I'm in enough different timezones for the discord hours count to not make sense on my end.