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

Fix(MessagesList): Limit relative date up to a week. #11837

Merged
merged 1 commit into from Mar 18, 2024

Conversation

DorraJaouad
Copy link
Contributor

☑️ Resolves

  • Relative dates are better shown until a week ago (as it used to be).

🖌️ UI Checklist

🖼️ Screenshots / Screencasts

🏚️ Before 🏡 After
image image

🏁 Checklist

  • 🌏 Tested with Chrome, Firefox and Safari or should not be risky to browser differences
  • 🖥️ Tested with Desktop client or should not be risky for it
  • 🖌️ Design was reviewed, approved or inspired by the design team
  • ⛑️ Tests are included or not possible
  • 📗 User documentation in https://github.com/nextcloud/documentation/tree/master/user_manual/talk has been updated or is not required

@DorraJaouad DorraJaouad added bug feature: chat 💬 Chat and system messages feature: frontend 🖌️ "Web UI" client labels Mar 17, 2024
@DorraJaouad DorraJaouad added this to the 💞 Next Beta (29) milestone Mar 17, 2024
@DorraJaouad DorraJaouad self-assigned this Mar 17, 2024
@@ -561,6 +561,8 @@ export default {
return t('spreed', 'Today')
case 1:
return t('spreed', 'Yesterday')
case 7:
return t('spreed', 'A week ago')
default:
return t('spreed', '{n} days ago', { n: diffDays })
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return t('spreed', '{n} days ago', { n: diffDays })
return n('spreed', .... { n: diffDays })

Needs to use the plural function

Don't know out of my head how it is in JS

But actually there should be a relative time function already which you can use directly?

Copy link
Contributor

Choose a reason for hiding this comment

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

There is something for it in moment lib

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is something for it in moment lib

Yeah, but it still needs some customization. We need a combination of date.fromNow() and moment().calendar() because the first shows the past days correctly ( except for yesterday and today, it shows in hours) and the second shows yesterday and tomorrow ( but along with hh:mm).

https://momentjs.com/

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's still not a default output from the lib. We are not avoiding the hurdle of custom anyhow.

We keep it as simple as it is now :) ? but it's better to use date.fromNow() instead of t('spreed', '{n} days ago', { n: diffDays }) indeed

Signed-off-by: DorraJaouad <dorra.jaoued7@gmail.com>
@DorraJaouad DorraJaouad force-pushed the fix/noid/relative-date-in-date-separators branch from e6c93e3 to 30af508 Compare March 17, 2024 20:03
Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

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

Works as expected, left a couple of comments

src/components/MessagesList/MessagesList.vue Show resolved Hide resolved
src/components/MessagesList/MessagesList.vue Show resolved Hide resolved
src/components/MessagesList/MessagesList.vue Show resolved Hide resolved
@nickvergessen nickvergessen merged commit dd0ce1a into main Mar 18, 2024
46 checks passed
@nickvergessen nickvergessen deleted the fix/noid/relative-date-in-date-separators branch March 18, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feature: chat 💬 Chat and system messages feature: frontend 🖌️ "Web UI" client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants