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: add localized formatting using date-fns #2160

Open
wants to merge 7 commits into
base: 13.5.0
Choose a base branch
from

Conversation

LuLaValva
Copy link
Member

Description

Use date-fns to localize date format in date textbox instead of using ISO.

Note

date-fns maintains their own list of locales that likely doesn't exactly match the browser. This is likely something we will need to maintain ourselves, or provide/find a mapping

Screenshots

image image

@LuLaValva LuLaValva self-assigned this Apr 22, 2024
Copy link

changeset-bot bot commented Apr 22, 2024

⚠️ No Changeset found

Latest commit: 0ba230c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@LuLaValva LuLaValva marked this pull request as ready for review April 22, 2024 20:50
Copy link
Contributor

@agliga agliga left a comment

Choose a reason for hiding this comment

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

Please update from master. Lets try to get this in a patch but lets fix conflicts first.

@LuLaValva
Copy link
Member Author

I'll update from master, but I think this should be part of at least a minor version since placeholder text will need to be updated in applications that are using the component.

@agliga
Copy link
Contributor

agliga commented Apr 30, 2024

I'll update from master, but I think this should be part of at least a minor version since placeholder text will need to be updated in applications that are using the component.

Can you show what teams need to do and what will break for teams?
Maybe we can add a temporary opt in for this localization so that teams can opt into it and then update the placeholder so its not breaking.

@LuLaValva
Copy link
Member Author

This is actually nontrivial for teams, since the placeholder needs to switch from being unconditionally YYYY-MM-DD to a localized format like MM/DD/YYYY for each locale. Alternatively, the placeholder can be removed or replaced with something like Date

@agliga
Copy link
Contributor

agliga commented May 1, 2024

This is actually nontrivial for teams, since the placeholder needs to switch from being unconditionally YYYY-MM-DD to a localized format like MM/DD/YYYY for each locale. Alternatively, the placeholder can be removed or replaced with something like Date

So for now: lets not make this automatic. If they want to get this new functionality, have them pass an argument like auto-localize=true.
Next major version we will remove that flag and have it turn on by default.

$ const {
a11yOpenPopoverText = "open calendar",
range,
inputPlaceholderText = "YYYY-MM-DD",
inputPlaceholderText = "MM/DD/YYYY",
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably keep the original default, otherwise it will be breaking if they don't pass in localizeFormat

agliga
agliga previously approved these changes May 8, 2024
Copy link
Contributor

@agliga agliga left a comment

Choose a reason for hiding this comment

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

Approving for now if that placeholder issue is fixed.

@LuLaValva LuLaValva changed the base branch from master to 13.5.0 May 15, 2024 21:09
@agliga
Copy link
Contributor

agliga commented May 15, 2024

Need to update snapshots in tests. @LuLaValva

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.

None yet

2 participants