Skip to content

Match the time zone list to Rails - #85

Merged
dadachi merged 2 commits into
mainfrom
fix/time-zones-match-rails
Oct 15, 2026
Merged

dadachi merged 2 commits into
mainfrom
fix/time-zones-match-rails

Conversation

@dadachi

@dadachi dadachi commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Port of dadachi/MyTurnTagCreator-Android#137 (same change as nativeapptemplate/NativeAppTemplate-Android#126).

Problem

TimeZones.map had 151 zones, but the API validates time_zone against ActiveSupport::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:

  • Asuncion added (GMT-03:00)
  • Greenland: GMT-03:00 → GMT-02:00
  • Almaty, Astana: GMT+06:00 → GMT+05:00
  • Casablanca, Dublin: GMT+01:00 → GMT+00:00

Fix

TimeZones.map is now exactly the Rails list, with the same labels in the same order.

Effect on currentTimeZoneKey (the default zone offered from the device):

  • America/Asuncion → Asuncion (was Brasilia, or Atlantic Time with tzdata older than 2024b)
  • America/Nuuk → Greenland (was Mid-Atlantic)
  • Africa/Accra and the zone GMT → Casablanca, now the first GMT+00:00 zone in Rails order (were Edinburgh)

Tests

TimeZonesTest:

  • map_isTheRailsTimeZoneList: the map equals the embedded output of bin/rails runner 'ActiveSupport::TimeZone.all.each { |z| puts "#{z.name}\t#{z.to_s}" }' run in nativeapptemplateapi.
  • currentTimeZoneKey_asuncion_isAsuncion and currentTimeZoneKey_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.
  • The two existing GMT+00:00 fallback tests now expect Casablanca instead of Edinburgh.

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-push passes locally: spotlessCheck, lintDebug, :app:minifyReleaseWithR8 and ./gradlew test.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YDK5huvuRECyVrsQEdTN9q

dadachi and others added 2 commits October 15, 2026 17:09
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
@dadachi
dadachi merged commit a8feb35 into main Oct 15, 2026
1 check passed
@dadachi
dadachi deleted the fix/time-zones-match-rails branch October 15, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant