-
Notifications
You must be signed in to change notification settings - Fork 177
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
base: main
Are you sure you want to change the base?
Conversation
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"; | ||
} |
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.
These are untranslated English strings. Instead, we should show strings in the user's chosen language.
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.
Thank you for the feedback, @chrisbobbe.
Please can you provide a suggestion on how i should achieve that?
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.
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?
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.
Okay thank you, I will look that up.
This PR resolves the issue of displaying a user friendly date format in the lightbox appbar rather than showing the normal timestamp.
fixes #45