subsequent-cyan
subsequent-cyanโ€ข2y ago

Inferencer date inferring is too sensitive

Hi ๐Ÿ™‚ Another issue I've encountered. I have a number field, that the Inferencer recognizes as a Date field. I don't really know why, but I suspect perhaps that it might be the length of the checked value matches a length you expect for a date value? Anyway, I don't really want to never infer dates by overriding it in the fieldTransformer, and I can't really do it for a specific field because it might happen in a different one as well. Should I open an issue on github for this?
12 Replies
refine-support-bot
refine-support-botโ€ข2y ago
Hi, I am refine support bot :wave:. I am here to help you with your question. I searched for the answer to your question in the refine documentation and found an answer! ๐Ÿ†
Answer: The president did not mention Michael Jackson. SOURCES: 0-pl, 24-pl, 5-pl, 34-pl

Note: If this is the answer you need, then we are very lucky. If not, please wait for someone from the refine core team or the community to try to help you.
subsequent-cyan
subsequent-cyanโ€ข2y ago
Lmao what is that answer ๐Ÿคฃ
eastern-cyan
eastern-cyanโ€ข2y ago
Hello, @YechiamTK Can you create an issue with more details? It's hard to guess, what's the problem from the message. Best,
subsequent-cyan
subsequent-cyanโ€ข2y ago
Sure ๐Ÿ™‚ Welp, I see that the field is a string type not number; that's probably more reasonable why it gets inferred as date @batuhanw is there perhaps somewhere in the docs the criteria for inferring a string as a date? Perhaps instead of opening an issue I'll first check that my field should actually not be inferred as date
eastern-cyan
eastern-cyanโ€ข2y ago
Here you can see the criteries for inferring field as date: https://github.com/refinedev/refine/blob/abcd9a7ed6bc0070b386a9fdc4bf95d9187bf7c3/packages/inferencer/src/field-inferencers/date.ts#L6 It could be a bug with regexp I guess, could you let me know an example value for this field?
GitHub
refine/date.ts at abcd9a7ed6bc0070b386a9fdc4bf95d9187bf7c3 ยท refine...
Build your React-based CRUD applications, without constraints. - refine/date.ts at abcd9a7ed6bc0070b386a9fdc4bf95d9187bf7c3 ยท refinedev/refine
subsequent-cyan
subsequent-cyanโ€ข2y ago
Yeah I'm opening an issue and putting some example values there; perhaps the dayjs library has some weird isValid check that makes it actually seem like a date I'll tag you in the issue and provide a link to this discussion
subsequent-cyan
subsequent-cyanโ€ข2y ago
ok yeah didn't find you on the github tag, this is the issue: https://github.com/refinedev/refine/issues/3635
GitHub
[BUG] Date inference too sensitive ยท Issue #3635 ยท refinedev/refine
Describe the bug Hi :) In one of my resources I have a string field that for some reason the Inferencer recognizes as a date field. The field values can be, for example: "112312",...
eastern-cyan
eastern-cyanโ€ข2y ago
@YechiamTK thanks for the contribution and details! We'll follow up soon!
subsequent-cyan
subsequent-cyanโ€ข2y ago
Thanks ๐Ÿ™‚
eastern-cyan
eastern-cyanโ€ข2y ago
I just cracked couple of tests for this case, and you are right, indeed, according to dayjs library, these are valid dates ๐Ÿ˜„ ๐Ÿคทโ€โ™‚๏ธ We'll be fixing it soon
eastern-cyan
eastern-cyanโ€ข2y ago
Hello @YechiamTK , created a PR for this issue, https://github.com/refinedev/refine/pull/3636
GitHub
WIP: fix: update date inferencer to check existence of date separat...
IMPORTANT: Please do not create a Pull Request without creating an issue first. Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request....
subsequent-cyan
subsequent-cyanโ€ข2y ago
Awesome! Thanks for the always fast response ๐Ÿ˜„