-
Notifications
You must be signed in to change notification settings - Fork 31
Issue 1710: add absolute datetimestamps #1713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Issue 1710: add absolute datetimestamps #1713
Conversation
…re about iOS/Mac side).
|
Hi! Thanks a lot for the PR. I really appreciate it. Regarding the iOS part, after introducing 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 Also, to keep the test suite passing, you’ll need to add a Thanks again! |
|
Thanks for the feedback!
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.
Done.
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." |
| 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" | ||
| } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like so?
…t for JVMFormatter.
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):
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.