Skip to content
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

Improve relative time formatting in the notification activity. #3895

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Isira-Seneviratne
Copy link
Contributor

Improve the relative time formatting used in the notification activity for when the time difference is 1 week or greater.

Screenshots

Before
Screenshot_20230320_084247_Wikipedia

After
Screenshot_20230320_084923_Wikipedia Beta

Copy link
Member

@dbrant dbrant left a comment

Choose a reason for hiding this comment

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

This is an improvement, but might actually be too much of an improvement.
I'm not sure the "years ago" and "months ago" cases are really needed.

  • If a notification was received "1 year ago", does it mean "1 year + 1 day", or does it mean "1 year + 364 days" ago? These are huge differences, and therefore no longer very useful.
  • The "months" case will never be totally accurate because not all months have the same number of days.

Let's keep the maximum granularity as weeks, and if the time is greater than 10 weeks in the past, keep displaying it as the regular formatted date (as before).
Also, even in the weeks case, the DateUtils.getRelativeTimeSpanString() function can format it for us automatically, using the WEEK_IN_MILLIS constant, so we shouldn't need any new plurals resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants