Support both tzinfo v1 and v2 alongwith non-half hour offsets.#8880
Support both tzinfo v1 and v2 alongwith non-half hour offsets.#8880jekyllbot merged 3 commits intojekyll:masterfrom
Conversation
Use the defined offset (in a v1 and v2 compatible way) instead of determining the offset from the difference between local time and UTC. Change the minutes calculation to allow for time zones that don't use hour or half hour offsets (e.g. Australia/Eucla's UTC+08:45). Resolves jekyll#8516.
|
@philr Thank you very much for submitting this PR. This module is currently used only for builds on Windows platform. So, does native zoneinfo on non-Windows OS / platforms correctly set non-half hour offset out-of-the-box? If not, could the |
|
I've added a scenario to test the non-half hour offset behaviour. Native zoneinfo will handle the non-half hour offset correctly. |
|
@mattr- Requesting a re-review for this one.
|
Gemfile
Outdated
| gem "test-theme", :path => File.expand_path("test/fixtures/test-theme", __dir__) | ||
| gem "test-theme-skinny", :path => File.expand_path("test/fixtures/test-theme-skinny", __dir__) | ||
| gem "test-theme-symlink", :path => File.expand_path("test/fixtures/test-theme-symlink", __dir__) | ||
| gem "tzinfo", ">= 1", "< 3" |
There was a problem hiding this comment.
I moved tzinfo into the test group because the new TestWinTz tests run on all platforms. The tests are still passing on non-Windows because tzinfo is being brought in through another dependency.
There was a problem hiding this comment.
The WinTZ utility module is only used in Windows:
Lines 133 to 139 in f51ccbf
So as of now, testing the module on non-Windows platforms is redundant.
That said, I was hoping to use the WinTZ in all platforms in a separate PR, after merging this.
|
Totally forgot about this. @jekyllbot: merge +minor |
Phil Ross: Support both tzinfo v1 and v2 alongwith non-half hour offsets. (#8880) Merge pull request 8880
|
Backporting to v3.9.x in #9280. |
This is a 🙋 feature or enhancement.
Summary
This pull request changes
WinTZ.calculateto support use with tzinfo v2 as well as the currently supported v1. Instead of determining the offset from the difference between local time and UTC, it now uses the defined offset returned by tzinfo (in a v1 and v2 compatible way).The offset minutes calculation has also been changed to allow for time zones that don't use hour or half hour offsets. For example, Australia/Eucla's is at +08:45. Before the change, this would have resulted in WTZ-08:30 instead of the correct WTZ-08:45.
The new
gemfile_contentsand Windows documentation have updated to allow use with either tzinfo v1 or v2.Unit tests for WinTZ have been added. This required adding tzinfo and tzinfo-data to the
:testgroup in the Gemfile.Context
Resolves #8516.