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

How to work with timezones? #10

Closed
TheRatG opened this issue Oct 10, 2016 · 4 comments
Closed

How to work with timezones? #10

TheRatG opened this issue Oct 10, 2016 · 4 comments

Comments

@TheRatG
Copy link

TheRatG commented Oct 10, 2016

Hello.

For example, I would like init open hours in UTC and need check isOpen() in America/Denver zone.

@sebastiandedeyne
Copy link
Member

You could create a DateTime object with the current time, set the timezone to UTC and pass it into the isOpenAt() method.

https://github.com/spatie/opening-hours/blob/master/src/OpeningHours.php#L97

@sebastiandedeyne
Copy link
Member

I'd accept a PR (with tests), that allows you to declare a timezone when creating the OpeningHours object, and does the conversion inside any method that uses a DateTime parameter.

@TheRatG
Copy link
Author

TheRatG commented Oct 13, 2016

Thanks a lot.

@sebastiandedeyne
Copy link
Member

PR has been merged, and tagged as 1.1.0! 🎈

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

No branches or pull requests

3 participants