Skip to content

Conversation

@danguyf
Copy link

@danguyf danguyf commented Jan 20, 2026

Issue link: #1710

This PR adds a setting allowing a choice between relative (default) and absolute datetimestamps on posts.

To conserve space where possible, the formatting of the absolute datetimestamps "collapse" according to how recent they are. Examples, given the current date of 2026-01-19 (a Monday):

  • A post from 2pm today: 2:00PM
  • A post from 2pm yesterday: Sun 2:00PM
  • A post from 2pm a week ago: 12 Jan 2:00PM
  • A post from 2pm a year ago: 2025-01-19 2:00PM

The Android implementation is complete and tested. The desktop app is theoretical. The iOS implementation is non-existent.

Looking forward to any feedback, and getting fully up to speed and moving on to meatier contributions.

@Tlaster
Copy link
Contributor

Tlaster commented Jan 20, 2026

Hi! Thanks a lot for the PR. I really appreciate it.

Regarding the iOS part, after introducing AppleFormatter, the remaining task is essentially wiring a toggle in the iOS settings UI. If it’s inconvenient for you to finish the iOS part, I can add it after this pull request is merged.

One thing I noticed is that the current absolute timestamp formatting uses a hard coded pattern. I’d prefer to use locale and region appropriate formatting (for example, using DateUtils to format the output on Android), so that the output matches the user’s language and region expectations.

Also, to keep the test suite passing, you’ll need to add a TestFormatter implementation to ImportOPMLPresenterTest. The test setup is messy right now, but adding that piece should make the tests run correctly.

Thanks again!

@danguyf
Copy link
Author

danguyf commented Jan 20, 2026

Thanks for the feedback!

One thing I noticed is that the current absolute timestamp formatting uses a hard coded pattern. I’d prefer to use locale and region appropriate formatting (for example, using DateUtils to format the output on Android), so that the output matches the user’s language and region expectations.

Great point. I will admit that I was intentionally imposing my own preference for UK style dates, which is super myopic. Thanks for calling this out. Fixed.

Also, to keep the test suite passing, you’ll need to add a TestFormatter implementation to ImportOPMLPresenterTest. The test setup is messy right now, but adding that piece should make the tests run correctly.

Done.

Regarding the iOS part, after introducing AppleFormatter, the remaining task is essentially wiring a toggle in the iOS settings UI. If it’s inconvenient for you to finish the iOS part, I can add it after this pull request is merged.

You make it sound so simple. I took a look at the existing code and it looked pretty simple so I added the toggle. I don't have an iOS device or means of emulating one set up at the moment so it's entirely notional. As Donald Knuth famously said, "Beware of bugs in the above code; I have only proved it correct, not tried it."

Comment on lines 89 to 98
daysDiff < 7 -> {
val day = DateTimeFormatter.ofPattern("EEE", locale).format(zonedDateTime)
val time = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(locale).format(zonedDateTime)
"$day $time"
}
nowDate.year == instantDate.year -> {
val date = DateTimeFormatter.ofPattern("MMM d", locale).format(zonedDateTime)
val time = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(locale).format(zonedDateTime)
"$date, $time"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The date time format here is still hard-coded, I wonder can we use something like DateTimeFormatterBuilder.getLocalizedDateTimePattern generate the date time pattern?

Copy link
Author

Choose a reason for hiding this comment

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

Like so?

@danguyf danguyf requested a review from Tlaster January 21, 2026 02:34
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.

[Feature Request] Option to display absolute timestamps rather than relative

2 participants