-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport #8880 for v3.9.x: Support both tzinfo v1 and v2 alongwith no…
…n-half hour offsets (#9280) This backports 9c9cf3e to 3.9-stable Co-authored-by: Phil Ross <philr@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
96 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require "helper" | ||
|
||
class TestWinTz < JekyllUnitTest | ||
[["America/New_York", "WTZ+05:00"], ["Europe/Paris", "WTZ-01:00"]].each do |tz, expected| | ||
should "use base offset in winter for #{tz}" do | ||
result = Jekyll::Utils::WinTZ.calculate(tz, Time.utc(2021, 1, 1)) | ||
assert_equal expected, result | ||
end | ||
end | ||
|
||
[["America/New_York", "WTZ+04:00"], ["Europe/Paris", "WTZ-02:00"]].each do |tz, expected| | ||
should "apply DST in summer for #{tz}" do | ||
result = Jekyll::Utils::WinTZ.calculate(tz, Time.utc(2021, 7, 1)) | ||
assert_equal expected, result | ||
end | ||
end | ||
|
||
[["Australia/Eucla", "WTZ-08:45"], ["Pacific/Marquesas", "WTZ+09:30"]].each do |tz, expected| | ||
should "handle non zero minutes for #{tz}" do | ||
result = Jekyll::Utils::WinTZ.calculate(tz, Time.utc(2021, 1, 1)) | ||
assert_equal expected, result | ||
end | ||
end | ||
|
||
should "return zero for UTC" do | ||
result = Jekyll::Utils::WinTZ.calculate("UTC") | ||
assert_equal "WTZ+00:00", result | ||
end | ||
end |