Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert "Permieres on" UTC time to local time #1429

Closed
dennis1248 opened this issue Jun 18, 2021 · 20 comments · Fixed by flathub/io.freetubeapp.FreeTube#78
Closed

Convert "Permieres on" UTC time to local time #1429

dennis1248 opened this issue Jun 18, 2021 · 20 comments · Fixed by flathub/io.freetubeapp.FreeTube#78
Labels

Comments

@dennis1248
Copy link
Contributor

dennis1248 commented Jun 18, 2021

Currently "Premieres on" seems to be using UTC time instead of local time. I live in UTC+02:00 so a stream or video premier starting at 19:00:00 local time will be reported as starting on 17:00:00 UTC.

Could someone knowledgeable with the codebase confirm that this is indeed what FreeTube is doing? I am just guessing here as to what this behavior is caused by.

@Winterhuman
Copy link

@PrestonN Any update on this issue? It seems to of been incorrectly labelled as an enhancement instead of a bug

@Aiz0
Copy link
Contributor

Aiz0 commented Jun 20, 2022

I use Freetube v0.16.0 on Arch Linux and currently use CEST time.
I don't experience this issue, premiere time is reported as correct local time for me.
@Winterhuman in the issue you opened you said you use FreeTube v0.13.2 Beta, have you tried any later versions of freetube?

While i say premiere time is reported correctly, it's displayed in the mm/dd/yyyy format with a 12 hour clock, I don't use this format at all.
I thought this is might be related to some locale setting on my end but It's still formatted like that despite changing LC_TIME.
Should I open an issue for this is, or is it something on my end.

@Winterhuman
Copy link

Good question, I haven't tested this for a while and also haven't looked at any streams. I'll report back here if I can confirm or deny that this is still an issue

@Winterhuman
Copy link

@Aiz0 The date format is probably hard-coded, probably best to open an issue for supporting LC_TIME

@Aiz0
Copy link
Contributor

Aiz0 commented Jul 1, 2022

After setting ALL locale variables it seems to be using correct date format, yyyy-mm-dd with 24 hour clock.

Freetube uses the toLocaleString() to return the premier date as a string with locale settings.

Firefox seems to behave the same.
Launching Firefox with LC_TIME=en_US.UTF-8 does not change date formatting.
Launching it with LC_ALL=en_US.UTF-8 does.

It's very weird.

@Winterhuman
Copy link

Yep, this is still an issue in FreeTube v0.16. timedatectl shows:

               Local time: Fri 2022-07-01 22:03:10 BST
           Universal time: Fri 2022-07-01 21:03:10 UTC
                 RTC time: Fri 2022-07-01 21:03:10
                Time zone: Europe/London (BST, +0100)

But, https://youtu.be/_BDClzHu-ho says it starts at 01/07/2022, 22:00:00, and it's 22:04 now; the video should say it starts at 23:00:00 and use BST time.

@Aiz0
Copy link
Contributor

Aiz0 commented Jul 1, 2022

Could this issue be related to Flathub/flatpak then?
I've tested both the aur version and the portable x64 and both use correct time zone.

I've found this disscussion regarding another flathub app.
flathub/com.slack.Slack#43

From the discussion this was a temporary solution so try launching freetube like this If you still use flatpak
flatpak override --user --env=TZ=Europe/London io.freetubeapp.FreeTube

@Aiz0
Copy link
Contributor

Aiz0 commented Jul 3, 2022

After Installing FreeTube via flatpak I can confirm that premiere time will display in UTC.
2022-07-03_T21:44:48
Here you can see the difference between premiere time for flatpak install (left) and aur build(right) for a random upcoming livestream.

After running the override command once, flatpak freetube displayed the same premiere time as the aur build.
flatpak override --user --env=TZ=Europe/Stockholm io.freetubeapp.FreeTube
I only needed to run this once and it doesn't actually launch freetube. That was a misunderstanding on my part.

Now that the cause is known this issue should probably be renamed or moved to the flathub repository.

I also found out that the date format seems to depend on LC_MESSAGES for some reason.

@Winterhuman
Copy link

Winterhuman commented Jul 8, 2022

For some reason, the FreeTube Flatpak manually sets TZ=UTC by default, which overrides the timezone of the system (I think, I need to wait for a stream again to see if removing it has solved everything)

No other Flatpak I have installed sets TZ manually, I wonder why this is the case; perhaps it solves a bug from the past?

EDIT: Nevermind, the video release times are still one hour behind even after removing TZ=UTC.

@Winterhuman
Copy link

@efb4f5ff-1298-471a-8973-3d47447115dc Any chance you could comment on this?

@Aiz0
Copy link
Contributor

Aiz0 commented Sep 16, 2022

I looked into this again and removing --env=TZ=UTC seems to fix the issue for the latest freetube version on flathub.
I get the correct timezone when i run Intl.DateTimeFormat().resolvedOptions().timeZone in console.

The reason it was added seems to be because of a crash if the time zone was unknown.
flathub/io.freetubeapp.FreeTube@279265a
I tested it by changing to a unknown timezone--env=TZ=ETC/Unknown but I did not experience a crash.

running Intl.DateTimeFormat().resolvedOptions().timeZone returned Undefined
and new Date().ToLocaleString() returned this '16/09/2022'

I suppose the workaround is no longer required in later versions of electron.
I'll open a pull request on the flathub repository later.

@Winterhuman could you try removing TZ=UTC on v0.17.1 and see if you get the same results?

@Aiz0
Copy link
Contributor

Aiz0 commented Sep 16, 2022

There's a build on the testing repository now: https://buildbot.flathub.org/#/builders/32/builds/110792
you can install it with this command

flatpak install --user https://dl.flathub.org/build-repo/108415/io.freetubeapp.FreeTube.flatpakref

@Winterhuman
Copy link

I'll check next time I find a stream premiere

@Aiz0
Copy link
Contributor

Aiz0 commented Sep 17, 2022

Open this in browser and you should be able to find some upcoming live streams.
https://www.youtube.com/live

@Winterhuman
Copy link

Winterhuman commented Sep 17, 2022

Regardless of TZ=UTC or not, it's reporting the same time for me. However, the build you linked is changing the time to be an hour ahead of where it was which is correct

EDIT: Turns out I have to set TZ=UTC+1:00 before the time changes, removing the variable using Flatseal has no effect even after killing all Flatpak processes (for normal FreeTube)

@Aiz0
Copy link
Contributor

Aiz0 commented Sep 20, 2022

Just to be clear. Does the build I linked use the correct timezone without you having to make any modifications to the environment?

When you say you are removing TZ=UTC how exactly is that done? Are you using flatseal as you mentioned?

I have not tested this with flatseal but instead made a build without the line.
here's how to do it if you wanna try.

git clone https://github.com/flathub/io.freetubeapp.FreeTube
cd io.freetubeapp.FreeTube

remove line 16
https://github.com/flathub/io.freetubeapp.FreeTube/blob/4dea01520f7d6b5a6b5c72707c39a1c6fd3ee07d/io.freetubeapp.FreeTube.yml#L16
and then build and install it with flatpak-builder

flatpak-builder build io.freetubeapp.FreeTube.yml  --install --force-clear

The build linked contains the same modifications and both work on my end.

@Winterhuman
Copy link

Yes, your build does show the correct time

@efb4f5ff-1298-471a-8973-3d47447115dc

@Aiz0 u have fixed this issue right?

@Aiz0
Copy link
Contributor

Aiz0 commented Oct 22, 2022

@Aiz0 u have fixed this issue right?

As far as I know this should only be an issue on flatpak builds.
This issue will be fixed when flathub/io.freetubeapp.FreeTube#78 is merged.

@efb4f5ff-1298-471a-8973-3d47447115dc

Okay then ill close it because there is a separate repo for flatpak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants