Revert Utils::WinTZ upgrade and lock to TZInfo-1.x (#7562)

Revert "Add missing divider in upgrading-guide"
This reverts commit d8c745ca30.

Revert "Update history to reflect merge of #7521"
This reverts commit 7ee2e26d6c.

Revert "Upgrade WinTZ utility to use TZInfo-2.0"
This reverts commit 13cbef4221.

Lock use of `tzinfo` gem to v1.x
This commit is contained in:
Ashwin Maroli 2019-03-10 17:20:48 +05:30 committed by GitHub
parent 3036d36a7c
commit 5fa93015a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 27 deletions

View File

@ -84,7 +84,7 @@ group :jekyll_optional_dependencies do
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library # and associated library
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
gem "tzinfo", "~> 2.0" gem "tzinfo", "~> 1.2"
gem "tzinfo-data" gem "tzinfo-data"
end end
end end

View File

@ -134,7 +134,6 @@
* Search Front matter defaults for Page objects with relative_path (#7261) * Search Front matter defaults for Page objects with relative_path (#7261)
* Support for binary operators in where_exp filter (#6998) * Support for binary operators in where_exp filter (#6998)
* Configure cache_dir (#7232) * Configure cache_dir (#7232)
* Upgrade WinTZ utility to use TZInfo-2.0 (#7521)
### Major Enhancements ### Major Enhancements

View File

@ -48,22 +48,6 @@ you can invoke *`Liquid::Template`* directly:
--- ---
### Timezone in Windows
Timezone handling for Jekyll on Windows now requires `tzinfo-2.0` and above.
Simply add / update the gem listing in your `Gemfile`:
```ruby
# Gemfile
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "tzinfo", "~> 2.0"
```
---
### Exclusion changes ### Exclusion changes
We've enhanced our default exclusion array. It now looks like the following: We've enhanced our default exclusion array. It now looks like the following:

View File

@ -92,7 +92,7 @@ module Jekyll
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library. # and associated library.
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
gem "tzinfo", "~> 2.0" gem "tzinfo", "~> 1.2"
gem "tzinfo-data" gem "tzinfo-data"
end end

View File

@ -13,20 +13,16 @@ module Jekyll
# Returns a string that ultimately re-defines ENV["TZ"] in Windows # Returns a string that ultimately re-defines ENV["TZ"] in Windows
def calculate(timezone) def calculate(timezone)
External.require_with_graceful_fail("tzinfo") unless defined?(TZInfo) External.require_with_graceful_fail("tzinfo") unless defined?(TZInfo)
difference = TZInfo::Timezone.get(timezone).now.utc_offset tz = TZInfo::Timezone.get(timezone)
difference = Time.now.to_i - tz.now.to_i
# #
# POSIX style definition reverses the offset sign. # POSIX style definition reverses the offset sign.
# e.g. Eastern Standard Time (EST) that is 5Hrs. to the 'west' of Prime Meridian # e.g. Eastern Standard Time (EST) that is 5Hrs. to the 'west' of Prime Meridian
# is denoted as: # is denoted as:
# EST+5 (or) EST+05:00 # EST+5 (or) EST+05:00
# Reference: http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html # Reference: http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
if difference.negative? sign = difference.negative? ? "-" : "+"
offset = "-" offset = sign == "-" ? "+" : "-" unless difference.zero?
sign = "+"
else
offset = "+"
sign = "-"
end
# #
# convert the difference (in seconds) to hours, as a rational number, and perform # convert the difference (in seconds) to hours, as a rational number, and perform
# a modulo operation on it. # a modulo operation on it.