mattermost / mattermost-mobile

Next generation iOS and Android apps for Mattermost in React Native
https://about.mattermost.com/
Apache License 2.0
2.27k stars 1.38k forks source link

feat: Switch FormattedDate component to Intl.DateTimeFormat #8276

Closed KuSh closed 4 weeks ago

KuSh commented 1 month ago

Summary

Use Intl.DateTimeFormat instead of fixed momentjs format in FormattedDate component

This comes from a discussion in i18n - Localization channel in mattermost community where Ian Liu reported bad date formatting for Chinese and Japanese languages. After some digging it appeared there were more problems than that and I suggested to switch from momentjs to Intl.DateTimeFormat

Ticket Link

Checklist

Device Information

This PR was tested on: Android Emulator - Nexus 8 API 31 and OnePlus 6 running /e/OS 2.4.1-t

Screenshots

English Japanese French
en ja fr

Release Note

Rework date format to respect languages and regions specificities
mattermost-build commented 1 month ago

Hello @KuSh,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

enahum commented 1 month ago

Maybe should consider adding an end to end test or unit tests to make sure this does not break again

larkox commented 1 month ago

@KuSh I see many stylistic changes that do not completely conform with our codebase. Do you mind removing the stylistic changes so the PR is clearer?

KuSh commented 1 month ago

@KuSh I see many stylistic changes that do not completely conform with our codebase. Do you mind removing the stylistic changes so the PR is clearer?

Sure, I tried to configure prettier to follow you codebase / eslint but it seems I didn't succeed :/

KuSh commented 1 month ago

@larkox I've removed stylistic changes

KuSh commented 4 weeks ago

@rahimrahman I've pushed the requested changes!