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

lightbox: Use a friendlier format for the date #987

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

Conversation

mofirojean
Copy link

@mofirojean mofirojean commented Oct 5, 2024

This PR resolves the issue of displaying a user friendly date format in the lightbox appbar rather than showing the normal timestamp.

fixes #45

Comment on lines +150 to +164
if (difference.inSeconds < 60) {
return "A few seconds ago";
} else if (difference.inMinutes < 60) {
return "${difference.inMinutes} ${difference.inMinutes == 1 ? 'minute' : 'minutes'} ago";
} else if (difference.inHours < 24) {
final time = DateFormat.jm(locale).format(messageDate);
return "Today at $time";
} else if (difference.inHours < 48) {
final time = DateFormat.jm(locale).format(messageDate);
return "Yesterday at $time";
} else {
final date = DateFormat('MMM d, yyyy', locale).format(messageDate);
final time = DateFormat('hh:mm a', locale).format(messageDate);
return "$date at $time";
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are untranslated English strings. Instead, we should show strings in the user's chosen language.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the feedback, @chrisbobbe.
Please can you provide a suggestion on how i should achieve that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not able to prioritize that right now; this is a post-launch issue. Maybe there's a library out there that can handle this for us?

Copy link
Author

Choose a reason for hiding this comment

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

Okay thank you, I will look that up.

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.

lightbox: Use a friendlier format for the date, like "Yesterday at 4:47 PM"
2 participants