From fe16b9090f4f6c74f6d9c7cc7d75467683f598e7 Mon Sep 17 00:00:00 2001 From: Joyce Miryam Habbouche Date: Wed, 18 Nov 2026 10:56:42 -0500 Subject: [PATCH 1/2] Fix Nunavut postal-code time zones --- CHANGELOG.md | 1 + data/regions/CA.yml | 38 +++++++++-------- test/worldwide/regions/ca_timezones_test.rb | 45 +++++++++++++++++++++ 3 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 test/worldwide/regions/ca_timezones_test.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 110802a5e..e444d209f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +- Correct the time zones for Nunavut postal codes in Kitikmeot, Kivalliq, Resolute and Arctic Bay. - Add an `AGENTS.md` contribution guide and document when contributors need a changelog entry. [#686](https://github.com/Shopify/worldwide/pull/686) - Add the `postal:codes:import`, `postal:codes:check` and `postal:codes:zone_check` rake tasks. They build and check the `zip_prefixes` and `zips_crossing_provinces` data in `data/regions/.yml`. [#680](https://github.com/Shopify/worldwide/pull/680) diff --git a/data/regions/CA.yml b/data/regions/CA.yml index 73158fa03..8d8abdc91 100644 --- a/data/regions/CA.yml +++ b/data/regions/CA.yml @@ -437,6 +437,8 @@ timezones: - G0G 2P - G0G 2R - G0G 2W + America/Cambridge_Bay: + - X0B America/Edmonton: - S0M 0A4 - S0M 0A8 @@ -491,7 +493,6 @@ timezones: - V0E 2L - V1A - V1C - - X0B - X0E - X0G - X1 @@ -509,6 +510,22 @@ timezones: - G0C 0E9 - G0C 2R - G4T + America/Iqaluit: + - X0A 0A0 + - X0A 0B3 + America/Rankin_Inlet: + - X0C 0A0 + - X0C 0A1 + - X0C 0A3 + - X0C 0A4 + - X0C 0A5 + - X0C 0A6 + - X0C 0A7 + - X0C 0B + - X0C 0E + - X0C 0G + - X0C 0H + - X0C 0J America/Regina: - S0A - S0C @@ -614,6 +631,9 @@ timezones: - S9A - S9H - S9X + America/Resolute: + - X0A 0A2 + - X0A 0V America/St_Johns: - A0A - A0B @@ -1092,19 +1112,3 @@ timezones: - S0P 0A1 - S0P 0A2 - S0P 0B - - X0A 0A0 - - X0A 0A2 - - X0A 0B3 - - X0A 0V - - X0C 0A0 - - X0C 0A1 - - X0C 0A3 - - X0C 0A4 - - X0C 0A5 - - X0C 0A6 - - X0C 0A7 - - X0C 0B - - X0C 0E - - X0C 0G - - X0C 0H - - X0C 0J diff --git a/test/worldwide/regions/ca_timezones_test.rb b/test/worldwide/regions/ca_timezones_test.rb new file mode 100644 index 000000000..7cdaecea7 --- /dev/null +++ b/test/worldwide/regions/ca_timezones_test.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +require "test_helper" + +module Worldwide + class CanadianTimezonesTest < ActiveSupport::TestCase + test "Nunavut and neighboring postal codes have the correct timezone prefixes" do + expected_timezones = { + "X0B 0C0" => "America/Cambridge_Bay", + "X0B 1J0" => "America/Cambridge_Bay", + "X0C 0A0" => "America/Rankin_Inlet", + "X0C 0A1" => "America/Rankin_Inlet", + "X0C 0A3" => "America/Rankin_Inlet", + "X0C 0A4" => "America/Rankin_Inlet", + "X0C 0A5" => "America/Rankin_Inlet", + "X0C 0A6" => "America/Rankin_Inlet", + "X0C 0A7" => "America/Rankin_Inlet", + "X0C 0B0" => "America/Rankin_Inlet", + "X0C 0E0" => "America/Rankin_Inlet", + "X0C 0G0" => "America/Rankin_Inlet", + "X0C 0H0" => "America/Rankin_Inlet", + "X0C 0J0" => "America/Rankin_Inlet", + "X0A 0V0" => "America/Resolute", + "X0A 0A2" => "America/Resolute", + "X0A 0A0" => "America/Iqaluit", + "X0A 0B3" => "America/Iqaluit", + "X0A 0H0" => "America/Toronto", + "X0C 0A2" => "America/Atikokan", + "X0C 0C0" => "America/Atikokan", + "X0E 0A0" => "America/Edmonton", + "X0G 0A0" => "America/Edmonton", + "X1A 2N8" => "America/Edmonton", + "T5J 2R7" => "America/Edmonton", + "R3C 4T3" => "America/Winnipeg", + } + + timezones = Worldwide.region(code: "CA").timezones + expected_timezones.each do |postal_code, timezone| + matches = timezones.select { |_name, prefixes| prefixes.any? { |prefix| postal_code.start_with?(prefix) } }.keys + + assert_equal [timezone], matches, postal_code + end + end + end +end From 87d8d1f2acdc58d3e581709e81df5e20ac4868fc Mon Sep 17 00:00:00 2001 From: Joyce Miryam Habbouche Date: Wed, 18 Nov 2026 11:50:23 -0500 Subject: [PATCH 2/2] Follow Canadian region test conventions --- CHANGELOG.md | 2 +- test/worldwide/regions/{ca_timezones_test.rb => ca_test.rb} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename test/worldwide/regions/{ca_timezones_test.rb => ca_test.rb} (96%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e444d209f..c7fb8a5c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] -- Correct the time zones for Nunavut postal codes in Kitikmeot, Kivalliq, Resolute and Arctic Bay. +- Correct the time zones for Nunavut postal codes in Kitikmeot, Kivalliq, Resolute and Arctic Bay. [#685](https://github.com/Shopify/worldwide/pull/685) - Add an `AGENTS.md` contribution guide and document when contributors need a changelog entry. [#686](https://github.com/Shopify/worldwide/pull/686) - Add the `postal:codes:import`, `postal:codes:check` and `postal:codes:zone_check` rake tasks. They build and check the `zip_prefixes` and `zips_crossing_provinces` data in `data/regions/.yml`. [#680](https://github.com/Shopify/worldwide/pull/680) diff --git a/test/worldwide/regions/ca_timezones_test.rb b/test/worldwide/regions/ca_test.rb similarity index 96% rename from test/worldwide/regions/ca_timezones_test.rb rename to test/worldwide/regions/ca_test.rb index 7cdaecea7..07c9c04db 100644 --- a/test/worldwide/regions/ca_timezones_test.rb +++ b/test/worldwide/regions/ca_test.rb @@ -3,7 +3,7 @@ require "test_helper" module Worldwide - class CanadianTimezonesTest < ActiveSupport::TestCase + class CaTest < ActiveSupport::TestCase test "Nunavut and neighboring postal codes have the correct timezone prefixes" do expected_timezones = { "X0B 0C0" => "America/Cambridge_Bay",