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

feat: Switch FormattedDate component to Intl.DateTimeFormat #8276

Merged
merged 7 commits into from
Oct 30, 2024

Conversation

KuSh
Copy link
Contributor

@KuSh KuSh commented Oct 20, 2024

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

  • Added or updated unit tests (required for all new features)
  • Has UI changes
  • Includes text changes and localization file updates
  • Have tested against the 5 core themes to ensure consistency between them.
  • Have run E2E tests by adding label E2E iOS tests for PR.

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
Copy link
Contributor

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
Copy link
Contributor

enahum commented Oct 21, 2024

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

@enahum enahum added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Oct 21, 2024
@larkox
Copy link
Contributor

larkox commented Oct 22, 2024

@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
Copy link
Contributor Author

KuSh commented Oct 22, 2024

@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 KuSh force-pushed the feature/use-intl-datetimeformat branch from 845efaf to 80a06ae Compare October 22, 2024 12:15
@KuSh
Copy link
Contributor Author

KuSh commented Oct 22, 2024

@larkox I've removed stylistic changes

Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

Looks great! Only some minor changes needed.

app/components/custom_status/custom_status_expiry.tsx Outdated Show resolved Hide resolved
app/components/files/file_info.tsx Outdated Show resolved Hide resolved
app/components/formatted_date/index.test.tsx Outdated Show resolved Hide resolved
app/components/formatted_date/index.tsx Outdated Show resolved Hide resolved
@KuSh KuSh force-pushed the feature/use-intl-datetimeformat branch from 35a4ba5 to 723b55b Compare October 26, 2024 12:34
@KuSh KuSh marked this pull request as ready for review October 26, 2024 12:35
@KuSh KuSh requested a review from larkox October 26, 2024 12:45
Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you very much for the changes!

@rahimrahman rahimrahman self-requested a review October 28, 2024 17:45
Copy link
Contributor

@rahimrahman rahimrahman left a comment

Choose a reason for hiding this comment

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

Thanks @KuSh for making the changes. And participate in the healthy discussion. Just like others, I've learned a bit more about internalization. I really appreciate all your contributions.

I have a request for change on the implementation and another request for improvement on the test. Both are not required.

app/components/post_list/date_separator/index.tsx Outdated Show resolved Hide resolved
app/components/formatted_date/index.test.tsx Show resolved Hide resolved
@rahimrahman rahimrahman removed the 2: Dev Review Requires review by a core commiter label Oct 28, 2024
@KuSh
Copy link
Contributor Author

KuSh commented Oct 29, 2024

@rahimrahman I've pushed the requested changes!

@rahimrahman rahimrahman added QA Review Done and removed 3: QA Review Requires review by a QA tester labels Oct 30, 2024
@rahimrahman rahimrahman merged commit 0c587ab into mattermost:main Oct 30, 2024
4 checks passed
@KuSh KuSh deleted the feature/use-intl-datetimeformat branch October 31, 2024 07:37
@amyblais amyblais added this to the v2.23.0 milestone Oct 31, 2024
@amyblais amyblais added the Docs/Needed Requires documentation label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants