azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.04k stars 152 forks source link

Get summer/winter time from PHP timezone library #103

Closed c960657 closed 6 years ago

c960657 commented 6 years ago

The date of transition to/from daylight saving time, and whether daylight saving time has been used at all, has changed over the years. This information is available in the tz (Olson) database that is included in PHP.

This PR makes Yasumi use the tz database for calculating the transitions. This works for any timezone that observes daylight saving time.

It seems that PHP currently only supports years until 2037 (when Unix timestamps exceed 31 bits), but this will likely be fixed in due time, if daylight saving time exists at all at that time.

stelgenhof commented 6 years ago

Thanks for the PR! I think it is a good one, since it can now be used by other Holiday Providers as well. Always love a good refactor :)

c960657 commented 6 years ago

Travis is happy now :-)