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

Asynchronously require calendar locales #49

Open
corysimmons opened this issue Apr 14, 2019 · 7 comments
Open

Asynchronously require calendar locales #49

corysimmons opened this issue Apr 14, 2019 · 7 comments

Comments

@corysimmons
Copy link

These dependencies were not found:

* date-fns in ./node_modules/formol/src/async/CalendarField.jsx, ./node_modules/formol/src/async/CalendarFieldLocales.js
* date-fns/locale/fr in ./node_modules/formol/src/async/CalendarFieldLocales.js

To install them, you can run: npm install --save date-fns date-fns/locale/fr
@paradoxxxzero
Copy link
Member

date-fns is a peer dependency, en locale is not needed as it's the default.
I might need to make the other locales a conditional require though.

@corysimmons
Copy link
Author

Yeah I think adding a global setting, or a locale prop to <Formol> and/or <CalendarField> would be a nice user experience.

@paradoxxxzero
Copy link
Member

@corysimmons
Copy link
Author

import localeFr from 'date-fns/locale/fr'

@paradoxxxzero
Copy link
Member

What I meant is there is a global prop called i18n on Formol and a local on CalendarField.
I agree that even if you don't need the fr one, it will be imported anyway which is bad but not that bad.

@corysimmons
Copy link
Author

Ah okay. So date-fns comes with en built-in? So when I try to use that component, it requests fr, and that pkg isn't installed.

Yeah, I think remove fr and just do whatever the date-fns default is, or possibly make it a peer dep as well?

I don't really know what the best action is. I just know that when I go to use that calendar component it asks me to install fr 🤷‍♀️

@paradoxxxzero
Copy link
Member

Yep I'll work on it

@paradoxxxzero paradoxxxzero changed the title Add EN to date-fns locales Asynchronously require calendar locales Apr 19, 2019
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

No branches or pull requests

2 participants