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

daylight savings time #31

Open
mcfiredrill opened this issue Dec 11, 2019 · 4 comments
Open

daylight savings time #31

mcfiredrill opened this issue Dec 11, 2019 · 4 comments

Comments

@mcfiredrill
Copy link

Hi, thank you for your work on this project I've been using it for years!

I noticed that daylight savings time is not taken into account if you are making a recurrence spanning multiple years. Is it within the scope of the project to fix this?

@itay-grudev
Copy link

If you keep dates and times in UTC, you can safely ignore DST. It should be handled by the time zone conversion automatically.

@mcfiredrill
Copy link
Author

Hmm I am keeping all dates in UTC+00 on the server.

irb(main):211:0> ScheduledShow.find(438747).start_at 
=> Sun, 14 Mar 2021 16:00:00 UTC +00:00
irb(main):212:0> ScheduledShow.find(438747).end_at
=> Sun, 14 Mar 2021 18:00:00 UTC +00:00

It should be handled by the time zone conversion automatically.

I haven't found that to be the case. Whenever DST happens my events are now an hour behind or ahead, and I need to update them accordingly. Is there anything else I might be doing wrong? 🤔

@itay-grudev
Copy link

itay-grudev commented Mar 15, 2021

Different time zones may or may not have DST and may even have different DST start and end dates. For this reason DST is added by the timezone conversion mechanism. By making sure Ruby/Rails's timezone is explicitly set to UTC you bypass the problem internally. Then whenever you convert a date-time to the user's time zone you add the DST correction whatever it is. Thus if only operating in UTC realm you shouldn't have DST issues.

So all you need to make sure is that your default timezone is UTC. Check it in Ruby and also check the corresponding ENV variables to see if it's set or overridden (I think it's ENV['TZ']).

@mcfiredrill
Copy link
Author

Still trying to figure this out 2 years later.
My rails app is definitely set to UTC.

irb(main):376:0> StreamPusher::Application.config.time_zone
=> "UTC"

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

No branches or pull requests

2 participants