tzinfo 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of tzinfo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9569ae7387d4f2847ba35f6a1268fbbc9019f9bbef1cc72e70569757320db079
4
- data.tar.gz: bb66169c01610b980c35be5c7102d780d07167b785acd6ea5887b89d15eb107d
3
+ metadata.gz: ddfbcb761e22870203af94d9cd3d47254ce0487d49ab51d804190d7d1961c125
4
+ data.tar.gz: f1e1f7eb70f406974d3fdbcda4cb78a6e2fa0842c0a6ec912fe80986a59e57fa
5
5
  SHA512:
6
- metadata.gz: d9847f779c051d96c2457d364b18bdc9bc74e9b17ffd8e84106ce9c6562b2634e60f08b81af9fff6ba7c0af3b898ba4483fe8e9fa31b3e004251b203c1bee933
7
- data.tar.gz: 8737907d69e81c06650a1f01b1ba45afc83f38a66b44fca093431cfea65208a92f56ada755e9f87724a6b866ecbfed11d1ef09552bbf983ce47c15c90269a322
6
+ metadata.gz: 5fe024d4d8c134dc324dedab7e6bca66293cf52e80ca16a3d32222e961dd5b563eead2bd110a72a212e7cde0e8ad0c87bc075ce19ad06e3d46ee0b3c3fb45c0a
7
+ data.tar.gz: 2c9c48dd44315d61129850ee160932f64afb1e90d8ca82dcd9388b2a79699c3b140340c9541ef822ba02d0791bc4df7c1c7e5a15c9d5840d37f177c1e5942242
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,12 @@
1
+ Version 1.2.9 - 16-Dec-2020
2
+ ---------------------------
3
+
4
+ * Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a
5
+ zoneinfo file that includes rules specifying an additional transition to the
6
+ final defined offset (for example, Africa/Casablanca in version 2018e of the
7
+ Time Zone Database). #123.
8
+
9
+
1
10
  Version 1.2.8 - 8-Nov-2020
2
11
  --------------------------
3
12
 
@@ -5,7 +14,7 @@ Version 1.2.8 - 8-Nov-2020
5
14
  default by zic version 2020b and later. The POSIX-style TZ string is now used
6
15
  calculate DST transition times after the final defined transition in the file.
7
16
  The 64-bit section is now always used regardless of whether Time has support
8
- for 64-bit times.
17
+ for 64-bit times. #120.
9
18
  * Rubinius is no longer supported.
10
19
 
11
20
 
@@ -313,8 +313,13 @@ module TZInfo
313
313
  last_year = (Time.at(last_defined[:at]).utc + previous_offset[:utc_total_offset]).year
314
314
 
315
315
  if last_year <= GENERATE_UP_TO
316
- generated = rules.transitions(last_year).find_all {|t| t.at > last_defined[:at] } +
317
- (last_year + 1).upto(GENERATE_UP_TO).map {|y| rules.transitions(y) }.flatten
316
+ last_defined_offset = offsets[last_defined[:offset]]
317
+
318
+ generated = rules.transitions(last_year).find_all do |t|
319
+ t.at > last_defined[:at] && !offset_matches_rule?(last_defined_offset, t.offset)
320
+ end
321
+
322
+ generated += (last_year + 1).upto(GENERATE_UP_TO).map {|y| rules.transitions(y) }.flatten
318
323
 
319
324
  unless generated.empty?
320
325
  transitions[-1] = validate_and_fix_last_defined_transition_offset(file, offsets, last_defined, generated[0].previous_offset)
@@ -1895,7 +1895,18 @@ class TCZoneinfoTimezoneInfo < Minitest::Test
1895
1895
  end
1896
1896
  end
1897
1897
 
1898
- def test_load_tz_string_specifies_transition_to_offset_of_final_transition_same_year
1898
+ def test_load_tz_string_specifies_transition_to_offset_of_final_transition_same_year_skip_dst_start
1899
+ # TZInfo v1.2.8 considered this to be an error. However, this is a valid
1900
+ # situation with Africa/Casablanca in 2018e.
1901
+ #
1902
+ # The last defined transitions are:
1903
+ # At 2037-03-29 02:00Z change to WEST UTC+1
1904
+ # At 2037-10-04 02:00Z change to WET UTC+0
1905
+ #
1906
+ # The rules define the end of DST to be at 03:00 local time on the last
1907
+ # Sunday of October (2037-10-31). This later transition needs to be
1908
+ # ignored.
1909
+
1899
1910
  offsets = [
1900
1911
  {:gmtoff => 7142, :isdst => false, :abbrev => 'LMT'},
1901
1912
  {:gmtoff => 7200, :isdst => false, :abbrev => 'XST'},
@@ -1916,9 +1927,76 @@ class TCZoneinfoTimezoneInfo < Minitest::Test
1916
1927
  JulianDayOfYearTransitionRule.new(300, 7200)
1917
1928
  )
1918
1929
 
1930
+ generate_up_to = ZoneinfoTimezoneInfo::GENERATE_UP_TO
1931
+
1919
1932
  tzif_test(offsets, transitions, :rules => rules) do |path, format|
1920
- error = assert_raises(InvalidZoneinfoFile) { ZoneinfoTimezoneInfo.new('Invalid/Offset', path, @posix_tz_parser) }
1921
- assert_equal("The first offset indicated by the POSIX-style TZ string did not match the final defined offset in file '#{path}'.", error.message)
1933
+ info = ZoneinfoTimezoneInfo.new('Ignore/Std', path, @posix_tz_parser)
1934
+ assert_equal('Ignore/Std', info.identifier)
1935
+
1936
+ assert_period(:LMT, 7142, 0, false, nil, Time.utc(1971, 1, 2, 2, 0, 0) - 7142, info)
1937
+ assert_period(:XST, 7200, 0, false, Time.utc(1971, 1, 2, 2, 0, 0) - 7142, Time.utc(1981, 4, 10, 1, 0, 0) - 7200, info)
1938
+ assert_period(:XDT, 7200, 3600, true, Time.utc(1981, 4, 10, 1, 0, 0) - 7200, Time.utc(1981, 10, 27, 2, 0, 0) - 10800, info)
1939
+ assert_period(:XST, 7200, 0, false, Time.utc(1981, 10, 27, 2, 0, 0) - 10800, Time.utc(1982, 4, 10, 1, 0, 0) - 7200, info)
1940
+ assert_period(:XDT, 7200, 3600, true, Time.utc(1982, 4, 10, 1, 0, 0) - 7200, Time.utc(1982, 10, 27, 2, 0, 0) - 10800, info)
1941
+
1942
+ 1983.upto(generate_up_to).each do |year|
1943
+ assert_period(:XST, 7200, 0, false, Time.utc(year - 1, 10, 27, 2, 0, 0) - 10800, Time.utc(year, 4, 11, 1, 0, 0) - 7200, info)
1944
+ assert_period(:XDT, 7200, 3600, true, Time.utc(year, 4, 11, 1, 0, 0) - 7200, Time.utc(year, 10, 27, 2, 0, 0) - 10800, info)
1945
+ end
1946
+
1947
+ assert_period(:XST, 7200, 0, false, Time.utc(generate_up_to, 10, 27, 2, 0, 0) - 10800, nil, info)
1948
+ end
1949
+ end
1950
+
1951
+ def test_load_tz_string_specifies_transition_to_offset_of_final_transition_same_year_skip_dst_end
1952
+ # TZInfo v1.2.8 considered this to be an error. However, this is a valid
1953
+ # situation with Africa/Casablanca in 2018e.
1954
+ #
1955
+ # The last defined transitions are:
1956
+ # At 2037-03-29 02:00Z change to WEST UTC+1
1957
+ # At 2037-10-04 02:00Z change to WET UTC+0
1958
+ #
1959
+ # The rules define the end of DST to be at 03:00 local time on the last
1960
+ # Sunday of October (2037-10-31). This later transition needs to be
1961
+ # ignored.
1962
+
1963
+ offsets = [
1964
+ {:gmtoff => 7142, :isdst => false, :abbrev => 'LMT'},
1965
+ {:gmtoff => 7200, :isdst => false, :abbrev => 'XST'},
1966
+ {:gmtoff => 10800, :isdst => true, :abbrev => 'XDT'}
1967
+ ]
1968
+
1969
+ transitions = [
1970
+ {:at => Time.utc(1971, 1, 2, 2, 0, 0) - 7142, :offset_index => 1},
1971
+ {:at => Time.utc(1981, 4, 10, 1, 0, 0) - 7200, :offset_index => 2},
1972
+ {:at => Time.utc(1981, 10, 27, 2, 0, 0) - 10800, :offset_index => 1}
1973
+ ]
1974
+
1975
+ rules = AnnualRules.new(
1976
+ TimezoneOffset.new(7200, 0, 'XST'),
1977
+ TimezoneOffset.new(7200, 3600, 'XDT'),
1978
+ JulianDayOfYearTransitionRule.new(100, 3600),
1979
+ JulianDayOfYearTransitionRule.new(301, 7200)
1980
+ )
1981
+
1982
+ generate_up_to = ZoneinfoTimezoneInfo::GENERATE_UP_TO
1983
+
1984
+ tzif_test(offsets, transitions, :rules => rules) do |path, format|
1985
+ info = ZoneinfoTimezoneInfo.new('Ignore/Std', path, @posix_tz_parser)
1986
+ assert_equal('Ignore/Std', info.identifier)
1987
+
1988
+ assert_period(:LMT, 7142, 0, false, nil, Time.utc(1971, 1, 2, 2, 0, 0) - 7142, info)
1989
+ assert_period(:XST, 7200, 0, false, Time.utc(1971, 1, 2, 2, 0, 0) - 7142, Time.utc(1981, 4, 10, 1, 0, 0) - 7200, info)
1990
+ assert_period(:XDT, 7200, 3600, true, Time.utc(1981, 4, 10, 1, 0, 0) - 7200, Time.utc(1981, 10, 27, 2, 0, 0) - 10800, info)
1991
+ assert_period(:XST, 7200, 0, false, Time.utc(1981, 10, 27, 2, 0, 0) - 10800, Time.utc(1982, 4, 10, 1, 0, 0) - 7200, info)
1992
+
1993
+ 1982.upto(generate_up_to - 1).each do |year|
1994
+ assert_period(:XDT, 7200, 3600, true, Time.utc(year, 4, 10, 1, 0, 0) - 7200, Time.utc(year, 10, 28, 2, 0, 0) - 10800, info)
1995
+ assert_period(:XST, 7200, 0, false, Time.utc(year, 10, 28, 2, 0, 0) - 10800, Time.utc(year + 1, 4, 10, 1, 0, 0) - 7200, info)
1996
+ end
1997
+
1998
+ assert_period(:XDT, 7200, 3600, true, Time.utc(generate_up_to, 4, 10, 1, 0, 0) - 7200, Time.utc(generate_up_to, 10, 28, 2, 0, 0) - 10800, info)
1999
+ assert_period(:XST, 7200, 0, false, Time.utc(generate_up_to, 10, 28, 2, 0, 0) - 10800, nil, info)
1922
2000
  end
1923
2001
  end
1924
2002
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'tzinfo'
3
- s.version = '1.2.8'
3
+ s.version = '1.2.9'
4
4
  s.summary = 'Daylight savings aware timezone library'
5
5
  s.description = 'TZInfo provides daylight savings aware transformations between times in different time zones.'
6
6
  s.author = 'Philip Ross'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tzinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Ross
@@ -29,7 +29,7 @@ cert_chain:
29
29
  J3Zn/kSTjTekiaspyGbczC3PUaeJNxr+yCvR4sk71Xmk/GaKKGOHedJ1uj/LAXrA
30
30
  MR0mpl7b8zCg0PFC1J73uw==
31
31
  -----END CERTIFICATE-----
32
- date: 2020-11-08 00:00:00.000000000 Z
32
+ date: 2020-12-16 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: thread_safe
metadata.gz.sig CHANGED
Binary file