rpodcast / shinycal

The Data Science StreamRs Calendar!
https://rpodcast.shinyapps.io/shinycal
Other
21 stars 4 forks source link

Streamer timezone is adjusted twice #23

Closed chendaniely closed 3 years ago

chendaniely commented 3 years ago

The default Pacific Time zone is "double" calculating the time for the streamer block (the current time is correct #20 is fixed)

If you look at the PDT time, e.g., favestats starts streaming at 13:00 EST, but it's showing up as 13 - 3 - 3 = 7:00

PDT:

image

But for some reason, it's calculating my time zone (EDT) correctly?

EDT:

image

I'm not sure what it looks like on your end, is it then adding 3 multiple times when you switch to EDT?

rpodcast commented 3 years ago

It turns out you are right on target: There were simply too many calculations of the offsets happening. Previously, I performed a conversion within a data munging step to prepare the calendar data for the widget. Specifically, I needed to translate the raw date/time coming from the Twitch API into a string format that toastui expects. The custom function I created called time_parser had a parameter for a new time zone for cases when I wanted to do the offset from the original time zone of America/New_York myself in this step.

After re-enabling the cal_timezone function when rendering the calendar via PR #20, that indeed added another offset based on the custom time zone selected.

If I simply parse the raw date/times to keep the original time zone of America/New_York, and let toastui handle the offset based on the selected time zone in the app, then everything seems to work. Here is your scheduled stream going from EDT to Pacific time:

Screenshot_2021-10-03_00-26-47

Screenshot_2021-10-03_00-28-12

If a few more ad-hoc tests pass, I'll commit the fix!