Skip to content

fix: use system time format in channel details - #1123

Open
guzino wants to merge 2 commits into
synonymdev:masterfrom
guzino:fix/channel-details-time-format
Open

fix: use system time format in channel details#1123
guzino wants to merge 2 commits into
synonymdev:masterfrom
guzino:fix/channel-details-time-format

Conversation

@guzino

@guzino guzino commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #1110

This PR routes the Lightning connection timestamps through the shared uiDateText entry point, so they follow the device's 12/24-hour setting.

Description

ChannelDetailScreen built its own DateTimeFormatter from DatePattern.CHANNEL_DETAILS, the hardcoded 24-hour pattern MMM d, yyyy, HH:mm. A connection created at 8:58 PM therefore read 20:58 on a device set to a 12-hour clock, while the activity list one screen away read 8:58 PM. #1111 added uiDateText and left this screen for a follow-up.

The date shape is kept exactly as it was. iOS renders this screen from MMM d, yyyy - HH:mm in LightningConnectionDetailView.swift, so the abbreviated month is the design, and only the fixed clock is the defect. That hardcoded HH:mm is present on iOS too, which this PR does not address.

  • Replaces formatDate and formatUnixTimestamp with uiDateText, so Created on, Order expiry, Opened on and Closed on all read the clock format from LocalIs24HourFormat.
  • Adds UiDateStyle.DATE_TIME_YEAR_SHORT for the MMM d, yyyy date this screen shares with iOS, leaving the four existing styles untouched.
  • Adds String.toEpochSecondsOrNull() in ext/DateTime.kt for the ISO-8601 strings Blocktank returns, keeping the previous behaviour of falling back to the raw string when it cannot be parsed.
  • Passes Opened on straight through as the ULong it already is. It previously went ULongLongInstant to rebuild the same value.
  • Drops DatePattern.CHANNEL_DETAILS and the screen's five date imports, all unused now.

Preview

compare-12h compare-clock-formats

QA Notes

Manual Tests

  • 1. Device on 12-hour time → Settings ▸ Advanced ▸ Lightning Connections ▸ Connection 1: Created on and Opened on both read Jul 31, 2026, 7:28 PM, matching the status bar.
  • 2. Device on 24-hour time → the same two rows read Jul 31, 2026, 19:28. The date keeps the Jul 31, 2026 shape in both.
  • 3. Open a closed connection: Closed on follows the same setting, and Order expiry does too on a pending order.
  • 4. regression: a connection whose order timestamp is malformed still renders the raw value instead of an empty row.

Automated Checks

  • Unit tests added in DateTimeExtTest.kt: toEpochSecondsOrNull over the plain and millisecond ISO-8601 forms, unparseable and empty input, the new style in both clock formats, and its month name under Locale.GERMANY.
  • Verified on an emulator against a regtest channel opened through Blocktank staging, in both clock settings.
  • Local: just compile, just test, just lint all pass, no new detekt findings.

@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Greptile Summary

Routes Lightning connection timestamps through the shared system-aware date formatter.

  • Adds a short month/day/year date-time style supporting device 12/24-hour preferences.
  • Adds lenient ISO-8601-to-epoch parsing while preserving raw malformed timestamp values.
  • Updates created, expiry, opened, and closed channel timestamps and adds focused unit coverage.
  • Documents the user-visible fix in the changelog.

Confidence Score: 5/5

The PR appears safe to merge with no concrete changed-code failure identified.

The new parsing path preserves malformed timestamp fallback, valid timestamps retain their epoch value through conversion, and the shared formatter observes the device clock-format state while keeping the intended abbreviated date shape.

Important Files Changed

Filename Overview
app/src/main/java/to/bitkit/ext/DateTime.kt Adds ISO-8601 epoch parsing and a localized abbreviated-month date-time style without altering existing styles.
app/src/main/java/to/bitkit/ui/settings/lightning/ChannelDetailScreen.kt Replaces screen-local timestamp formatting with the shared system-clock-aware formatter while retaining malformed-string fallback behavior.
app/src/test/java/to/bitkit/ext/DateTimeExtTest.kt Covers supported ISO timestamp forms, invalid inputs, clock formats, localization, and round-trip formatting.
changelog.d/next/1110.fixed.md Accurately describes the corrected device time-format behavior.

Reviews (1): Last reviewed commit: "fix: use system time format in channel d..." | Re-trigger Greptile

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.

Channel details time uses different time format to system

2 participants