Skip to content

fix(android): time formatting uses AM/PM in French locale - #87

Merged
sebsto merged 1 commit into
mainfrom
fix/86-android-time-locale
Aug 14, 2026
Merged

sebsto merged 1 commit into
mainfrom
fix/86-android-time-locale

Conversation

@sebsto

@sebsto sebsto commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Fixes #86

Problem

Date.formatted(date: .omitted, time: .shortened) on Android doesn't propagate the app locale to java.text.DateFormat, so French users see AM/PM instead of 24h format in the "Diffusé à" line.

Fix

Replace with an explicit DateFormatter that sets Locale.current, guarded behind #if os(Android). iOS path unchanged.

Upstream

Opened skiptools/skip-foundation#128 — once fixed there, this workaround can be removed.

Also

Documents Android build pitfalls in SKIP_ARCHITECTURE.md steering (don't import Foundation alongside SwiftUI, preferredLocalizations unavailable on Android).

Copilot AI lite review requested due to automatic review settings August 14, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes incorrect AM/PM time rendering for French users on Android by avoiding Date.formatted(date:time:) in the affected UI and using an explicit DateFormatter with Locale.current under #if os(Android). It also documents Android-specific build/locale pitfalls in the Skip architecture steering notes.

Changes:

  • Replaced Date.formatted(date: .omitted, time: .shortened) usage in SongLabelView with a new shortTimeString(from:) helper that sets DateFormatter.locale = Locale.current on Android.
  • Kept the iOS/macOS path unchanged by continuing to use Date.formatted(date:time:) on non-Android platforms.
  • Added an “Android Build Pitfalls” section to SKIP_ARCHITECTURE.md, including notes about locale propagation and imports.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Sources/Maxi80/Views/RadioPlayer/SongLabelView.swift Adds an Android-specific time formatting workaround and routes UI strings through it.
.kiro/steering/SKIP_ARCHITECTURE.md Documents Android Fuse-module pitfalls and the Date.formatted locale issue/workaround.
Suppressed comments (1)

Sources/Maxi80/Views/RadioPlayer/SongLabelView.swift:105

  • The doc comment says the Android workaround derives locale from the app bundle’s preferred localization, but the implementation uses Locale.current (and preferredLocalizations is documented as unavailable on Android in SKIP_ARCHITECTURE.md). This mismatch is confusing—please align the comment with the actual behavior.
  /// On iOS, `Date.formatted(date:time:)` correctly picks up the device locale. On Android (native
  /// fuse mode), SkipFoundation's implementation doesn't propagate the locale to the underlying
  /// `java.text.DateFormat`, causing French users to see AM/PM. Work around this by using an explicit
  /// `DateFormatter` with the locale derived from the app bundle's preferred localization.
  /// See: https://github.com/skiptools/skip-foundation/issues/128

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Sources/Maxi80/Views/RadioPlayer/SongLabelView.swift
Comment thread Sources/Maxi80/Views/RadioPlayer/SongLabelView.swift Outdated
@sebsto
sebsto force-pushed the fix/86-android-time-locale branch from c3f29e8 to 3762401 Compare August 14, 2026 09:37
@sebsto sebsto self-assigned this Aug 14, 2026
@sebsto sebsto added Android Android platform-specific issue bug Something isn't working labels Aug 14, 2026
Date.formatted(date:time:) on Android doesn't propagate the app locale
to java.text.DateFormat, causing French users to see AM/PM. Work around
this with an explicit DateFormatter + Locale.current inside #if os(Android).

Also documents Android build pitfalls in SKIP_ARCHITECTURE steering.
@sebsto
sebsto force-pushed the fix/86-android-time-locale branch from 3762401 to 0e86f0f Compare August 14, 2026 10:13
@sebsto
sebsto merged commit c5c7f55 into main Aug 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android Android platform-specific issue bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android : Played at shows am/pm in FR version

2 participants