-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
fix: map to correct locales for date-fns #289
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/picker/9cVHdkzQDnwLP9gPECRu16mC7oVy |
Hello, we ran into the mentioned bug and wondered if there's anything preventing this PR from being merged? |
@zombieJ ? 👀 |
Why has this not been merged? This change would solve the issue for several locales. Spawnia has done the tedious work of mapping the locales, why not reap the benefit already? Really need this for our product! |
@MadCcc would it be possible to merge this PR? |
Is that a more common way to auto generate locale? Seems this will has much maintain effort if enum all the locale. |
const dealLocal = (str: string) => {
const head = str.slice(0, str.indexOf('_'));
return Locale.hasOwnProperty(head) ? head : str.replace(/_/g, '');
} Maybe this way? |
I thought about a generalized solution, but in this case it is not worth it. Creating this pull request took me a few minutes of (admittedly tedious) work, but saved the time required to think through, test and future-proof another solution. The addition or removal of future locales should not happen often, and will be very easy to do and require little to no thought or testing. |
[REDACTED] |
Hello, 2 years later the #147 we are facing the same bug for the
The solution proposed by @MadCcc seems more general and would solve the issue for all locales. Really need this thanks |
Rebase please. |
this works for me: const dealLocal = (locale: string) => {
const loc = locale.replace(/_/g, '');
const head = locale.slice(0, locale.indexOf('_'));
return Locale[loc] ? loc : head;
}; |
2fc545f
to
e473a66
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Rebased and updated with the latest locales. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #289 +/- ##
==========================================
- Coverage 98.57% 98.57% -0.01%
==========================================
Files 63 63
Lines 2534 2530 -4
Branches 671 670 -1
==========================================
- Hits 2498 2494 -4
Misses 33 33
Partials 3 3 ☔ View full report in Codecov by Sentry. |
Resolves #147