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

Locale gives problem in edit form. #11

Closed
thecassion opened this issue Aug 4, 2018 · 8 comments
Closed

Locale gives problem in edit form. #11

thecassion opened this issue Aug 4, 2018 · 8 comments

Comments

@thecassion
Copy link


    in DateTextField
    in WithUtils(DateTextField) (created by WithStyles(WithUtils(DateTextField)))
    in WithStyles(WithUtils(DateTextField)) (created by ModalWrapper)
    in ModalWrapper (created by RenderPropsComponent)
    in RenderPropsComponent (created by withHandlers(RenderPropsComponent))
    in withHandlers(RenderPropsComponent) (created by lifecycle(withHandlers(RenderPropsComponent)))
    in lifecycle(withHandlers(RenderPropsComponent)) (created by withState(lifecycle(withHandlers(RenderPropsComponent))))
    in withState(lifecycle(withHandlers(RenderPropsComponent))) (created by BasePicker)
    in BasePicker
    in WithUtils(BasePicker) (created by DatePickerWrapper)
    in DatePickerWrapper (created by ForwardRef)
    in MuiPickersUtilsProvider (created by _makePicker)
    in div (created by _makePicker)
    in _makePicker (created by ConnectedField)
    in ConnectedField (created by Connect(ConnectedField))
    in Connect(ConnectedField) (created by Field)
    in Field (created by FormFieldView)
    in FormFieldView (created by DefaultValue)
    in DefaultValue (created by Connect(DefaultValue))
    in Connect(DefaultValue) (created by WithFormField)
    in WithFormField (at HealthCareEdit.js:56)
    in div (created by FormInput)
    in FormInput (created by WithStyles(FormInput))
    in WithStyles(FormInput) (created by FormTab)
    in span (created by FormTab)
    in FormTab (created by translate(FormTab))
    in translate(FormTab) (at HealthCareEdit.js:51)
    in Route (created by TabbedForm)
    in div (created by TabbedForm)
    in form (created by TabbedForm)
    in TabbedForm (created by WithStyles(TabbedForm))
    in WithStyles(TabbedForm) (created by Form(WithStyles(TabbedForm)))
    in Form(WithStyles(TabbedForm)) (created by Connect(Form(WithStyles(TabbedForm))))
    in Connect(Form(WithStyles(TabbedForm))) (created by ReduxForm)
    in ReduxForm (created by translate(ReduxForm))
    in translate(ReduxForm) (created by Connect(translate(ReduxForm)))
    in Connect(translate(ReduxForm)) (created by Route)
    in Route (created by withRouter(Connect(translate(ReduxForm))))
    in withRouter(Connect(translate(ReduxForm))) (at HealthCareEdit.js:50)
    in div (created by Paper)
    in Paper (created by WithStyles(Paper))
    in WithStyles(Paper) (created by Card)
    in Card (created by WithStyles(Card))
    in WithStyles(Card) (created by EditView)
    in div (created by EditView)
    in EditView (created by EditController)
    in EditController (created by translate(EditController))
    in translate(EditController) (created by Connect(translate(EditController)))
    in Connect(translate(EditController)) (created by Edit)
    in Edit (at HealthCareEdit.js:49)
    in HealthCareEdit (at App.js:75)
    in Unknown (created by WithPermissions)
    in WithPermissions (created by Connect(WithPermissions))
    in Connect(WithPermissions) (created by getContext(Connect(WithPermissions)))
    in getContext(Connect(WithPermissions)) (created by Route)
    in Route (created by Resource)
    in Switch (created by Resource)
    in Resource (created by Connect(Resource))
    in Connect(Resource) (created by AdminBuilder)
    in Route (created by RoutesWithLayout)
    in Switch (created by RoutesWithLayout)
    in RoutesWithLayout (created by Route)
    in div (created by Layout)
    in main (created by Layout)
    in div (created by Layout)
    in div (created by Layout)
    in Layout (created by WithStyles(Layout))
    in WithStyles(Layout) (created by Route)
    in Route (created by withRouter(WithStyles(Layout)))
    in withRouter(WithStyles(Layout)) (created by Connect(withRouter(WithStyles(Layout))))
    in Connect(withRouter(WithStyles(Layout))) (created by LayoutWithTheme)
    in MuiThemeProvider (created by LayoutWithTheme)
    in LayoutWithTheme (created by Route)
    in Route (created by CoreAdminRouter)
    in Switch (created by CoreAdminRouter)
    in div (created by CoreAdminRouter)
    in CoreAdminRouter (created by Connect(CoreAdminRouter))
    in Connect(CoreAdminRouter) (created by getContext(Connect(CoreAdminRouter)))
    in getContext(Connect(CoreAdminRouter)) (created by Route)
    in Route (created by CoreAdmin)
    in Switch (created by CoreAdmin)
    in Router (created by ConnectedRouter)
    in ConnectedRouter (created by CoreAdmin)
    in TranslationProvider (created by withContext(TranslationProvider))
    in withContext(TranslationProvider) (created by Connect(withContext(TranslationProvider)))
    in Connect(withContext(TranslationProvider)) (created by CoreAdmin)
    in Provider (created by CoreAdmin)
    in CoreAdmin (created by withContext(CoreAdmin))
    in withContext(CoreAdmin) (created by AdminBuilder)
    in AdminBuilder (created by _class)
    in _class (at App.js:147)
    in Unknown (at index.js:7)```
@lihop
Copy link
Contributor

lihop commented Aug 9, 2018

@thecassion Are you setting the locale prop and is this the error message you get (before the stack trace)?

RangeError: locale must contain localize property.

@Hanno73
Copy link

Hanno73 commented Aug 13, 2018

RangeError: locale must contain localize property.

I have this problem and cannot see the DatePicker at all.
I tried to set prop
locale="en-us"
or
import enLocale from 'date-fns/locale/en-US';
and then
locale={enLocale}

but none of it worked for me.

@jeffryevans
Copy link

This is problematic for us too.

@vascofg
Copy link
Owner

vascofg commented Aug 13, 2018 via email

@nadirberrara
Copy link

nadirberrara commented Aug 14, 2018

Had the same issue.

I removed the tags Edit, TabbedForm and FormTab from the exemple and left the DateTimeInput (the only one I need).

const NewsEdit = props => { return ( <DateTimeInput source="startDate" label="Start date" options={{ format: 'DD/MM/YYYY HH:mm', ampm: true, clearable: true }} /> ); };

export const MissionEdit = props => ( <Edit {...props}> <SimpleForm> <NewsEdit /> </SimpleForm> </Edit> );

Now it works for me.

@Hanno73
Copy link

Hanno73 commented Aug 14, 2018

creating a constant with just DateTimeInput and referencing it even inside a TabbedForm and FormTab worked also for me.
Thank you @nadirberrara

@vascofg vascofg changed the title Local gives problem in edit form. Locale gives problem in edit form. Aug 23, 2018
@vascofg
Copy link
Owner

vascofg commented Aug 23, 2018

I'm looking into this right now, in the meantime please use 1.0.16

@vascofg
Copy link
Owner

vascofg commented Aug 23, 2018

This is fixed in 1.0.20.

The problem was that the locale prop already existed in react-admin, so, when not defined in the picker component, instead of being undefined inside react-admin-date-inputs, it was receiving the value of the react-admin locale.

Anyway, please refer to the README.md for the new way to specify custom locales and util libs.

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

6 participants