Repository navigation
Match the time zone list to Rails - #85
Merged
Merged
Conversation
TimeZones.map had 151 zones; the API's ActiveSupport::TimeZone.all (nativeapptemplateapi, activesupport 8.1.4) has 152. Add Asuncion, and update the labels and order that changed with tzdata: Greenland -02:00, Almaty and Astana +05:00, Dublin and Casablanca +00:00. The map now equals the Rails list exactly, in Rails order, checked by a test that embeds the Rails output. A device in America/Asuncion now defaults to Asuncion (was Brasilia, or Atlantic Time with tzdata older than 2024b), and one in America/Nuuk to Greenland (was Mid-Atlantic). The first GMT+00:00 zone is now Casablanca, as in Rails, so Africa/Accra and the zone "GMT" default to Casablanca (were Edinburgh). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDK5huvuRECyVrsQEdTN9q
The API does not validate time_zone; its zones are simply ActiveSupport::TimeZone.all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDK5huvuRECyVrsQEdTN9q
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of dadachi/MyTurnTagCreator-Android#137 (same change as nativeapptemplate/NativeAppTemplate-Android#126).
Problem
TimeZones.maphad 151 zones, but the API validatestime_zoneagainstActiveSupport::TimeZone.all, which has 152 in nativeapptemplateapi (activesupport 8.1.4). Asuncion was missing, and several labels and their order were out of date with tzdata:Fix
TimeZones.mapis now exactly the Rails list, with the same labels in the same order.Effect on
currentTimeZoneKey(the default zone offered from the device):GMT→ Casablanca, now the first GMT+00:00 zone in Rails order (were Edinburgh)Tests
TimeZonesTest:map_isTheRailsTimeZoneList: the map equals the embedded output ofbin/rails runner 'ActiveSupport::TimeZone.all.each { |z| puts "#{z.name}\t#{z.to_s}" }'run in nativeapptemplateapi.currentTimeZoneKey_asuncion_isAsuncionandcurrentTimeZoneKey_nuuk_isGreenland: Robolectric's ICU data (sdk 35) is older than tzdata 2024b/2023a, so it still has Asuncion at GMT-04:00 and Nuuk at GMT-03:00. These tests set the zone's raw offset to the current value (-03:00 / -02:00) by hand. This template only matches the city among zones at the same standard offset, so Asuncion needs this too.Before the fix, 5 of 8 tests failed (map, Asuncion → Brasilia, Nuuk → Mid-Atlantic, Accra and GMT → Edinburgh). After the fix, all 8 pass.
Checks
scripts/pre-pushpasses locally: spotlessCheck, lintDebug,:app:minifyReleaseWithR8and./gradlew test.🤖 Generated with Claude Code
https://claude.ai/code/session_01YDK5huvuRECyVrsQEdTN9q