passive-yellow
passive-yellow17mo ago

Can't use other locale on DateFields from Inferencer

For example, I'm building an app with Mantine. The docs says this: https://refine.dev/docs/api-reference/mantine/components/fields/date/
If you need other locales, you can load them on demand. Refer to loading locales
But there's two problems: (1) The inferencer calls <DateField value={...} />, it doesn't ask about locales. (2) The dayjs lib is not exposed on windowor as a global variable, as the docs above seems to imply (also is the method on the source Dayjs' docs to import other locales, loading from a global variable in the browser into another global variable). This is about i18n but this is not provided by i18nProvider, that's the closest tag available for this post.
Date | refine
This field is used to display dates. It uses Day.js to display date format.
1 Reply
optimistic-gold
optimistic-gold17mo ago
Hey @rhengles, 1) Inferencer developed to create start point to create CRUD pages, so it doesn’t support of localization. You can use auto-generated code created from Inferencer then you can customize Date field or whatever do you want. 2) I think, you need install dayjs your project. Hey @rhengles, Yesterday, I'm on mobile and didn't quite understand your second question. When we review the code you're right, if you want to change dayjs instance in refine you can't do it. However you can swizzle the <DateField> component then you use whatever as you want. You can checkout the refine-cli documentation for more info about swizzle: https://refine.dev/docs/packages/documentation/cli/#commands