-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Automatically infer locales #8
Comments
This also doesn't need to be a breaking change. The |
Sounds like a good idea, but I'm not sure if the weekday names would work. It seems you can only get |
Hmm, yeah. This does seem to be consistent with how |
|
Could work to add a utility function for this for people who are fine with the weekdays being |
The
Intl.DateTimeFormat
API has a few neat utilities for date-specific localization, including ones that can be used by this component to simplify locales. Additionally when a provided local is not specified/undefined
, it will automatically return data based on the user'snavigator.language
making it ideal for this sort of thing. It also means that there's no hardcoding or date formatting libraries required (I think).In this setup, the consumer of the library can simply provide a locale string and have the browser automatically output a localized array. It also means that if no locale is specified (through props, I guess) the datepicker will use the user's system language without any bundle overhead from a library like
date-fns
.The text was updated successfully, but these errors were encountered: